Skip to content

Commit 5ecc8f3

Browse files
authored
Merge pull request #3160 from bitfriend/upgrade-sdk
[smallfix] Miscellaneous fix
2 parents 57cc503 + abfdaa9 commit 5ecc8f3

21 files changed

Lines changed: 311 additions & 34 deletions

native/test/src/tests/media_msg/blurhash.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,22 @@ async fn image_blurhash_support() -> Result<()> {
5858
while i > 0 {
5959
if let Some(diff) = stream.next().now_or_never().flatten() {
6060
match diff.action().as_str() {
61-
"PushBack" | "Set" => {
61+
"PushBack" => {
6262
let value = diff
6363
.value()
6464
.expect("diff pushback action should have valid value");
6565
if let Some(msg_content) = match_media_msg(&value, mimetype, &jpg_name) {
6666
found = Some(msg_content);
6767
}
6868
}
69+
"Set" => {
70+
let value = diff
71+
.value()
72+
.expect("diff set action should have valid value");
73+
if let Some(msg_content) = match_media_msg(&value, mimetype, &jpg_name) {
74+
found = Some(msg_content);
75+
}
76+
}
6977
"Reset" => {
7078
let values = diff
7179
.values()
@@ -144,14 +152,22 @@ async fn video_blurhash_support() -> Result<()> {
144152
while i > 0 {
145153
if let Some(diff) = stream.next().now_or_never().flatten() {
146154
match diff.action().as_str() {
147-
"PushBack" | "Set" => {
155+
"PushBack" => {
148156
let value = diff
149157
.value()
150158
.expect("diff pushback action should have valid value");
151159
if let Some(msg_content) = match_media_msg(&value, mimetype, &mp4_name) {
152160
found = Some(msg_content);
153161
}
154162
}
163+
"Set" => {
164+
let value = diff
165+
.value()
166+
.expect("diff set action should have valid value");
167+
if let Some(msg_content) = match_media_msg(&value, mimetype, &mp4_name) {
168+
found = Some(msg_content);
169+
}
170+
}
155171
"Reset" => {
156172
let values = diff
157173
.values()

native/test/src/tests/media_msg/download.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async fn room_msg_can_download_image() -> Result<()> {
6565
while i > 0 {
6666
if let Some(diff) = stream.next().now_or_never().flatten() {
6767
match diff.action().as_str() {
68-
"PushBack" | "Set" => {
68+
"PushBack" => {
6969
let value = diff
7070
.value()
7171
.expect("diff pushback action should have valid value");
@@ -77,6 +77,18 @@ async fn room_msg_can_download_image() -> Result<()> {
7777
found = Some((msg_content, event_id));
7878
}
7979
}
80+
"Set" => {
81+
let value = diff
82+
.value()
83+
.expect("diff set action should have valid value");
84+
if let Some(msg_content) = match_media_msg(&value, mimetype, &jpg_name) {
85+
let event_id = value
86+
.event_item()
87+
.and_then(|t| t.event_id())
88+
.expect("media msg should be timeline event item");
89+
found = Some((msg_content, event_id));
90+
}
91+
}
8092
"Reset" => {
8193
let values = diff
8294
.values()

native/test/src/tests/media_msg/thumbnail.rs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,22 @@ async fn room_msg_can_support_image_thumbnail() -> Result<()> {
7979
while i > 0 {
8080
if let Some(diff) = stream.next().now_or_never().flatten() {
8181
match diff.action().as_str() {
82-
"PushBack" | "Set" => {
82+
"PushBack" => {
8383
let value = diff
8484
.value()
8585
.expect("diff pushback action should have valid value");
8686
if let Some(msg_content) = match_media_msg(&value, mimetype, &jpg_name) {
8787
found = Some(msg_content);
8888
}
8989
}
90+
"Set" => {
91+
let value = diff
92+
.value()
93+
.expect("diff set action should have valid value");
94+
if let Some(msg_content) = match_media_msg(&value, mimetype, &jpg_name) {
95+
found = Some(msg_content);
96+
}
97+
}
9098
"Reset" => {
9199
let values = diff
92100
.values()
@@ -198,14 +206,22 @@ async fn room_msg_can_support_video_thumbnail() -> Result<()> {
198206
while i > 0 {
199207
if let Some(diff) = stream.next().now_or_never().flatten() {
200208
match diff.action().as_str() {
201-
"PushBack" | "Set" => {
209+
"PushBack" => {
202210
let value = diff
203211
.value()
204212
.expect("diff pushback action should have valid value");
205213
if let Some(msg_content) = match_media_msg(&value, mimetype, &mp4_name) {
206214
found = Some(msg_content);
207215
}
208216
}
217+
"Set" => {
218+
let value = diff
219+
.value()
220+
.expect("diff set action should have valid value");
221+
if let Some(msg_content) = match_media_msg(&value, mimetype, &mp4_name) {
222+
found = Some(msg_content);
223+
}
224+
}
209225
"Reset" => {
210226
let values = diff
211227
.values()
@@ -307,14 +323,22 @@ async fn room_msg_can_support_file_thumbnail() -> Result<()> {
307323
while i > 0 {
308324
if let Some(diff) = stream.next().now_or_never().flatten() {
309325
match diff.action().as_str() {
310-
"PushBack" | "Set" => {
326+
"PushBack" => {
311327
let value = diff
312328
.value()
313329
.expect("diff pushback action should have valid value");
314330
if let Some(msg_content) = match_media_msg(&value, mimetype, &pdf_name) {
315331
found = Some(msg_content);
316332
}
317333
}
334+
"Set" => {
335+
let value = diff
336+
.value()
337+
.expect("diff set action should have valid value");
338+
if let Some(msg_content) = match_media_msg(&value, mimetype, &pdf_name) {
339+
found = Some(msg_content);
340+
}
341+
}
318342
"Reset" => {
319343
let values = diff
320344
.values()
@@ -408,14 +432,22 @@ async fn room_msg_can_support_location_thumbnail() -> Result<()> {
408432
while i > 0 {
409433
if let Some(diff) = stream.next().now_or_never().flatten() {
410434
match diff.action().as_str() {
411-
"PushBack" | "Set" => {
435+
"PushBack" => {
412436
let value = diff
413437
.value()
414438
.expect("diff pushback action should have valid value");
415439
if let Some(msg_content) = match_location_msg(&value, body, geo_uri) {
416440
found = Some(msg_content);
417441
}
418442
}
443+
"Set" => {
444+
let value = diff
445+
.value()
446+
.expect("diff set action should have valid value");
447+
if let Some(msg_content) = match_location_msg(&value, body, geo_uri) {
448+
found = Some(msg_content);
449+
}
450+
}
419451
"Reset" => {
420452
let values = diff
421453
.values()

native/test/src/tests/msg_edit.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ async fn edit_image_msg() -> Result<()> {
169169
while i > 0 {
170170
if let Some(diff) = stream.next().now_or_never().flatten() {
171171
match diff.action().as_str() {
172-
"PushBack" | "Set" => {
172+
"PushBack" => {
173173
let value = diff
174174
.value()
175175
.expect("diff pushback action should have valid value");
@@ -178,6 +178,15 @@ async fn edit_image_msg() -> Result<()> {
178178
sent_event_id = Some(event_id);
179179
}
180180
}
181+
"Set" => {
182+
let value = diff
183+
.value()
184+
.expect("diff set action should have valid value");
185+
if let Some((event_id, body)) = match_image_msg(&value, mimetype, false) {
186+
assert_eq!(body, jpg_name, "msg body should be filename");
187+
sent_event_id = Some(event_id);
188+
}
189+
}
181190
"Reset" => {
182191
let values = diff
183192
.values()

native/test/src/tests/room/policy_rule_room.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,22 @@ async fn test_policy_rule_room() -> Result<()> {
4444
while i > 0 {
4545
if let Some(diff) = stream.next().now_or_never().flatten() {
4646
match diff.action().as_str() {
47-
"PushBack" | "Set" => {
47+
"PushBack" => {
4848
let value = diff
4949
.value()
5050
.expect("diff pushback action should have valid value");
5151
if let Some(result) = match_msg(&value) {
5252
found_result = Some(result);
5353
}
5454
}
55+
"Set" => {
56+
let value = diff
57+
.value()
58+
.expect("diff set action should have valid value");
59+
if let Some(result) = match_msg(&value) {
60+
found_result = Some(result);
61+
}
62+
}
5563
"Reset" => {
5664
let values = diff
5765
.values()

native/test/src/tests/room/policy_rule_server.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,22 @@ async fn test_policy_rule_server() -> Result<()> {
4444
while i > 0 {
4545
if let Some(diff) = stream.next().now_or_never().flatten() {
4646
match diff.action().as_str() {
47-
"PushBack" | "Set" => {
47+
"PushBack" => {
4848
let value = diff
4949
.value()
5050
.expect("diff pushback action should have valid value");
5151
if let Some(result) = match_msg(&value) {
5252
found_result = Some(result);
5353
}
5454
}
55+
"Set" => {
56+
let value = diff
57+
.value()
58+
.expect("diff set action should have valid value");
59+
if let Some(result) = match_msg(&value) {
60+
found_result = Some(result);
61+
}
62+
}
5563
"Reset" => {
5664
let values = diff
5765
.values()

native/test/src/tests/room/policy_rule_user.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,22 @@ async fn test_policy_rule_user() -> Result<()> {
4444
while i > 0 {
4545
if let Some(diff) = stream.next().now_or_never().flatten() {
4646
match diff.action().as_str() {
47-
"PushBack" | "Set" => {
47+
"PushBack" => {
4848
let value = diff
4949
.value()
5050
.expect("diff pushback action should have valid value");
5151
if let Some(result) = match_msg(&value) {
5252
found_result = Some(result);
5353
}
5454
}
55+
"Set" => {
56+
let value = diff
57+
.value()
58+
.expect("diff set action should have valid value");
59+
if let Some(result) = match_msg(&value) {
60+
found_result = Some(result);
61+
}
62+
}
5563
"Reset" => {
5664
let values = diff
5765
.values()

native/test/src/tests/room/room_avatar.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,22 @@ async fn test_room_avatar() -> Result<()> {
4949
while i > 0 {
5050
if let Some(diff) = stream.next().now_or_never().flatten() {
5151
match diff.action().as_str() {
52-
"PushBack" | "Set" => {
52+
"PushBack" => {
5353
let value = diff
5454
.value()
5555
.expect("diff pushback action should have valid value");
5656
if let Some(result) = match_msg(&value) {
5757
found_result = Some(result);
5858
}
5959
}
60+
"Set" => {
61+
let value = diff
62+
.value()
63+
.expect("diff set action should have valid value");
64+
if let Some(result) = match_msg(&value) {
65+
found_result = Some(result);
66+
}
67+
}
6068
"Reset" => {
6169
let values = diff
6270
.values()

native/test/src/tests/room/room_create.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,22 @@ async fn test_room_create() -> Result<()> {
3737
while i > 0 {
3838
if let Some(diff) = stream.next().now_or_never().flatten() {
3939
match diff.action().as_str() {
40-
"PushBack" | "Set" => {
40+
"PushBack" => {
4141
let value = diff
4242
.value()
4343
.expect("diff pushback action should have valid value");
4444
if let Some(result) = match_msg(&value) {
4545
found_result = Some(result);
4646
}
4747
}
48+
"Set" => {
49+
let value = diff
50+
.value()
51+
.expect("diff set action should have valid value");
52+
if let Some(result) = match_msg(&value) {
53+
found_result = Some(result);
54+
}
55+
}
4856
"Reset" => {
4957
let values = diff
5058
.values()

native/test/src/tests/room/room_encryption.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,22 @@ async fn test_room_encryption() -> Result<()> {
4242
while i > 0 {
4343
if let Some(diff) = stream.next().now_or_never().flatten() {
4444
match diff.action().as_str() {
45-
"PushBack" | "Set" => {
45+
"PushBack" => {
4646
let value = diff
4747
.value()
4848
.expect("diff pushback action should have valid value");
4949
if let Some(result) = match_msg(&value) {
5050
found_result = Some(result);
5151
}
5252
}
53+
"Set" => {
54+
let value = diff
55+
.value()
56+
.expect("diff set action should have valid value");
57+
if let Some(result) = match_msg(&value) {
58+
found_result = Some(result);
59+
}
60+
}
5361
"Reset" => {
5462
let values = diff
5563
.values()

0 commit comments

Comments
 (0)