Add DC_EVENT_SELFAVATAR_CHANGED (#2742)

* Add DC_EVENT_SELFAVATAR_CHANGED

* Add test.

Unfortunately I can't easily also test that the avatar is not copied
from unencrypted messages:

In the second encrypted message, the avatar would not be sent again
then, because we only send avatars once a day or so.

* Unfortunately I can't easily also test that the avatar is not copied from unencrypted messages:

In the second encrypted message, the avatar would not be sent again
then, because we only send avatars once a day or so.
This commit is contained in:
Hocuri
2021-10-18 10:42:16 +02:00
committed by GitHub
parent 41ec380b55
commit 6613fa67ee
8 changed files with 105 additions and 9 deletions

View File

@@ -621,7 +621,10 @@ mod tests {
use super::*;
use crate::{message::Message, test_utils::TestContext};
use crate::{
message::Message,
test_utils::{self, TestContext},
};
use image::Pixel;
#[async_std::test]
@@ -870,11 +873,10 @@ mod tests {
async fn test_selfavatar_in_blobdir() {
let t = TestContext::new().await;
let avatar_src = t.get_blobdir().join("avatar.png");
let avatar_bytes = include_bytes!("../test-data/image/avatar900x900.png");
File::create(&avatar_src)
.await
.unwrap()
.write_all(avatar_bytes)
.write_all(test_utils::AVATAR_900x900_BYTES)
.await
.unwrap();