Report modification paths as pre-delete/inserts as required for UITableView
This commit is contained in:
parent
d8a69b87dc
commit
4cf5d5db4c
|
@ -282,7 +282,12 @@ bool CollectionNotifier::deliver(Realm& realm, SharedGroup& sg, std::exception_p
|
|||
|
||||
bool should_call_callbacks = do_deliver(sg);
|
||||
m_changes_to_deliver = std::move(m_accumulated_changes);
|
||||
m_changes_to_deliver.modifications.remove(m_changes_to_deliver.insertions);
|
||||
|
||||
// FIXME: ugh
|
||||
// fixup modifications to be source rows rather than dest rows
|
||||
m_changes_to_deliver.modifications.erase_at(m_changes_to_deliver.insertions);
|
||||
m_changes_to_deliver.modifications.shift_for_insert_at(m_changes_to_deliver.deletions);
|
||||
|
||||
return should_call_callbacks && have_callbacks();
|
||||
}
|
||||
|
||||
|
|
|
@ -258,6 +258,18 @@ TEST_CASE("Results") {
|
|||
REQUIRE(change.modifications.empty());
|
||||
}
|
||||
|
||||
SECTION("modification indices are pre-insert/delete") {
|
||||
r->begin_transaction();
|
||||
table->set_int(0, 2, 0);
|
||||
table->set_int(0, 3, 6);
|
||||
r->commit_transaction();
|
||||
advance_and_notify(*r);
|
||||
|
||||
REQUIRE(notification_calls == 2);
|
||||
REQUIRE_INDICES(change.deletions, 1);
|
||||
REQUIRE_INDICES(change.modifications, 2);
|
||||
}
|
||||
|
||||
SECTION("notifications are not delivered when collapsing transactions results in no net change") {
|
||||
r->begin_transaction();
|
||||
size_t ndx = table->add_empty_row();
|
||||
|
|
Loading…
Reference in New Issue