mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-19 06:04:31 -04:00
test(ui): Add more tests.
This commit is contained in:
@@ -110,10 +110,10 @@ impl RoomList {
|
||||
/// possible to “paginate” over the entries by `page_size`.
|
||||
///
|
||||
/// The returned stream will only start yielding diffs once a filter is set
|
||||
/// through the returned `DynamicRoomListController`. For every call to
|
||||
/// [`DynamicRoomListController::set`], the stream will yield a
|
||||
/// [`VectorDiff::Reset`] followed by any updates of the room list under
|
||||
/// that filter (until the next reset).
|
||||
/// through the returned [`RoomListDynamicEntriesController`]. For every
|
||||
/// call to [`RoomListDynamicEntriesController::set_filter`], the stream
|
||||
/// will yield a [`VectorDiff::Truncate`] followed by any updates of the
|
||||
/// room list under that filter (until the next reset).
|
||||
pub fn entries_with_dynamic_adapters(
|
||||
&self,
|
||||
page_size: usize,
|
||||
@@ -240,7 +240,8 @@ impl RoomListDynamicEntriesController {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add one page.
|
||||
/// Add one page, i.e. view `page_size` more entries in the room list if
|
||||
/// any.
|
||||
pub fn add_one_page(&self) {
|
||||
if let Some(max) = self.maximum_number_of_rooms.borrow_mut().next_now() {
|
||||
let max: usize = max.try_into().unwrap();
|
||||
|
||||
@@ -1809,6 +1809,34 @@ async fn test_dynamic_entries_stream() -> Result<(), Error> {
|
||||
};
|
||||
assert_pending!(dynamic_entries_stream);
|
||||
|
||||
// Let's reset to one page.
|
||||
dynamic_entries.reset_to_one_page();
|
||||
|
||||
// Assert the dynamic entries.
|
||||
assert_entries_batch! {
|
||||
[dynamic_entries_stream]
|
||||
// Receive a `truncate`.
|
||||
truncate [5];
|
||||
end;
|
||||
}
|
||||
assert_pending!(dynamic_entries_stream);
|
||||
|
||||
// Let's ask one more page again, because it's fun.
|
||||
dynamic_entries.add_one_page();
|
||||
|
||||
// Assert the dynamic entries.
|
||||
assert_entries_batch! {
|
||||
[dynamic_entries_stream]
|
||||
// Receive the next values.
|
||||
append [
|
||||
F("!r5:bar.org"),
|
||||
F("!r6:bar.org"),
|
||||
F("!r7:bar.org"),
|
||||
];
|
||||
end;
|
||||
};
|
||||
assert_pending!(dynamic_entries_stream);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -279,7 +279,6 @@ mod tests {
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
use futures_util::StreamExt;
|
||||
use matrix_sdk_test::async_test;
|
||||
|
||||
use super::{
|
||||
|
||||
Reference in New Issue
Block a user