fix progress
This commit is contained in:
parent
8c412a6cff
commit
a8f16ab89d
@ -210,7 +210,7 @@ auto ring_buffer_open_file::download_chunk(std::size_t chunk, bool skip_active)
|
|||||||
chunk_lock.lock();
|
chunk_lock.lock();
|
||||||
if (res == api_error::success) {
|
if (res == api_error::success) {
|
||||||
auto progress =
|
auto progress =
|
||||||
(static_cast<double>(chunk) / static_cast<double>(total_chunks_)) *
|
(static_cast<double>(chunk + 1U) / static_cast<double>(total_chunks_)) *
|
||||||
100.0;
|
100.0;
|
||||||
event_system::instance().raise<download_progress>(fsi_.api_path,
|
event_system::instance().raise<download_progress>(fsi_.api_path,
|
||||||
source_path_, progress);
|
source_path_, progress);
|
||||||
|
@ -393,15 +393,15 @@ TEST_F(ring_buffer_open_file_test, read_full_file_in_reverse) {
|
|||||||
EXPECT_TRUE(nf2);
|
EXPECT_TRUE(nf2);
|
||||||
|
|
||||||
auto to_read = fsi.size;
|
auto to_read = fsi.size;
|
||||||
std::size_t chunk = rb.get_total_chunks() - 1u;
|
std::size_t chunk = rb.get_total_chunks() - 1U;
|
||||||
while (to_read) {
|
while (to_read > 0U) {
|
||||||
data_buffer data{};
|
data_buffer data{};
|
||||||
EXPECT_EQ(api_error::success,
|
EXPECT_EQ(api_error::success,
|
||||||
rb.read(test_chunk_size, chunk * test_chunk_size, data));
|
rb.read(test_chunk_size, chunk * test_chunk_size, data));
|
||||||
|
|
||||||
std::size_t bytes_written{};
|
std::size_t bytes_written{};
|
||||||
EXPECT_TRUE(nf2.write(data, chunk * test_chunk_size, &bytes_written));
|
EXPECT_TRUE(nf2.write(data, chunk * test_chunk_size, &bytes_written));
|
||||||
chunk--;
|
--chunk;
|
||||||
to_read -= data.size();
|
to_read -= data.size();
|
||||||
}
|
}
|
||||||
nf2.close();
|
nf2.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user