Progress bar for Notepad IO (#1322)

This commit is contained in:
Kyle Reed 2023-07-30 00:36:57 -07:00 committed by GitHub
parent 0a3aa706ef
commit 411f6c0a34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 73 additions and 3 deletions

View file

@ -435,4 +435,29 @@ SCENARIO("Delete line.") {
}
}
SCENARIO("It calls on_read_progress while reading.") {
GIVEN("A file larger than internal buffer_size (512)") {
std::string content = std::string(599, 'a');
content.push_back('x');
MockFile f{content};
auto w = wrap_buffer(f);
auto init_line_count = w.line_count();
auto init_size = w.size();
auto called = false;
w.on_read_progress = [&called](auto, auto) {
called = true;
};
WHEN("Replacing range with larger size") {
w.replace_range({0, 2}, "bbb");
THEN("callback should be called.") {
CHECK(called);
}
}
}
}
TEST_SUITE_END();