mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
test: display_chat(): Don't add day markers
Otherwise golden_test_chat() fails when run around midnight.
This commit is contained in:
@@ -27,8 +27,8 @@ use crate::chat::{
|
|||||||
};
|
};
|
||||||
use crate::chatlist::Chatlist;
|
use crate::chatlist::Chatlist;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
use crate::constants::DC_GCL_NO_SPECIALS;
|
||||||
use crate::constants::{Blocked, Chattype};
|
use crate::constants::{Blocked, Chattype};
|
||||||
use crate::constants::{DC_GCL_NO_SPECIALS, DC_MSG_ID_DAYMARKER};
|
|
||||||
use crate::contact::{Contact, ContactAddress, ContactId, Modifier, Origin};
|
use crate::contact::{Contact, ContactAddress, ContactId, Modifier, Origin};
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::e2ee::EncryptHelper;
|
use crate::e2ee::EncryptHelper;
|
||||||
@@ -701,16 +701,16 @@ impl TestContext {
|
|||||||
chat_id,
|
chat_id,
|
||||||
MessageListOptions {
|
MessageListOptions {
|
||||||
info_only: false,
|
info_only: false,
|
||||||
add_daymarker: true,
|
add_daymarker: false,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let msglist: Vec<MsgId> = msglist
|
let msglist: Vec<MsgId> = msglist
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|x| match x {
|
.filter_map(|x| match x {
|
||||||
ChatItem::Message { msg_id } => msg_id,
|
ChatItem::Message { msg_id } => Some(msg_id),
|
||||||
ChatItem::DayMarker { .. } => MsgId::new(DC_MSG_ID_DAYMARKER),
|
ChatItem::DayMarker { .. } => None,
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@@ -758,23 +758,17 @@ impl TestContext {
|
|||||||
|
|
||||||
let mut lines_out = 0;
|
let mut lines_out = 0;
|
||||||
for msg_id in msglist {
|
for msg_id in msglist {
|
||||||
if msg_id == MsgId::new(DC_MSG_ID_DAYMARKER) {
|
if msg_id.is_special() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if lines_out == 0 {
|
||||||
writeln!(res,
|
writeln!(res,
|
||||||
"--------------------------------------------------------------------------------"
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
lines_out += 1
|
|
||||||
} else if !msg_id.is_special() {
|
|
||||||
if lines_out == 0 {
|
|
||||||
writeln!(res,
|
|
||||||
"--------------------------------------------------------------------------------",
|
"--------------------------------------------------------------------------------",
|
||||||
).unwrap();
|
).unwrap();
|
||||||
lines_out += 1
|
lines_out += 1
|
||||||
}
|
|
||||||
let msg = Message::load_from_db(self, msg_id).await.unwrap();
|
|
||||||
write_msg(self, "", &msg, &mut res).await;
|
|
||||||
}
|
}
|
||||||
|
let msg = Message::load_from_db(self, msg_id).await.unwrap();
|
||||||
|
write_msg(self, "", &msg, &mut res).await;
|
||||||
}
|
}
|
||||||
if lines_out > 0 {
|
if lines_out > 0 {
|
||||||
writeln!(
|
writeln!(
|
||||||
|
|||||||
Reference in New Issue
Block a user