Add randomized test to remove active selections from buffer
This commit is contained in:
parent
4ce51c8138
commit
a00ce3f286
1 changed files with 24 additions and 18 deletions
|
@ -1804,6 +1804,11 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) {
|
||||||
}
|
}
|
||||||
30..=39 if mutation_count != 0 => {
|
30..=39 if mutation_count != 0 => {
|
||||||
buffer.update(cx, |buffer, cx| {
|
buffer.update(cx, |buffer, cx| {
|
||||||
|
if rng.gen_bool(0.2) {
|
||||||
|
log::info!("peer {} clearing active selections", replica_id);
|
||||||
|
active_selections.remove(&replica_id);
|
||||||
|
buffer.remove_active_selections(cx);
|
||||||
|
} else {
|
||||||
let mut selections = Vec::new();
|
let mut selections = Vec::new();
|
||||||
for id in 0..rng.gen_range(1..=5) {
|
for id in 0..rng.gen_range(1..=5) {
|
||||||
let range = buffer.random_byte_range(0, &mut rng);
|
let range = buffer.random_byte_range(0, &mut rng);
|
||||||
|
@ -1823,6 +1828,7 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) {
|
||||||
);
|
);
|
||||||
active_selections.insert(replica_id, selections.clone());
|
active_selections.insert(replica_id, selections.clone());
|
||||||
buffer.set_active_selections(selections, false, Default::default(), cx);
|
buffer.set_active_selections(selections, false, Default::default(), cx);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
mutation_count -= 1;
|
mutation_count -= 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue