@@ -263,7 +263,8 @@ class ContentExample {
263
263
]),
264
264
ImageNodeList ([
265
265
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png?version=3' ,
266
- thumbnailUrl: null , loading: false ),
266
+ thumbnailUrl: null , loading: false ,
267
+ originalWidth: null , originalHeight: null ),
267
268
]),
268
269
],
269
270
content: [ParagraphNode (links: null , nodes: [TextNode ('hello world' )])],
@@ -421,6 +422,22 @@ class ContentExample {
421
422
422
423
static const imageSingle = ContentExample (
423
424
'single image' ,
425
+ // https://chat.zulip.org/#narrow/stream/7-test-here/topic/Thumbnails/near/1900103
426
+ "[image.jpg](/user_uploads/2/ce/nvoNL2LaZOciwGZ-FYagddtK/image.jpg)" ,
427
+ '<div class="message_inline_image">'
428
+ '<a href="/user_uploads/2/ce/nvoNL2LaZOciwGZ-FYagddtK/image.jpg" title="image.jpg">'
429
+ '<img data-original-dimensions="6000x4000" src="/user_uploads/thumbnail/2/ce/nvoNL2LaZOciwGZ-FYagddtK/image.jpg/840x560.webp"></a></div>' , [
430
+ ImageNodeList ([
431
+ ImageNode (srcUrl: '/user_uploads/2/ce/nvoNL2LaZOciwGZ-FYagddtK/image.jpg' ,
432
+ thumbnailUrl: '/user_uploads/thumbnail/2/ce/nvoNL2LaZOciwGZ-FYagddtK/image.jpg/840x560.webp' ,
433
+ loading: false ,
434
+ originalWidth: 6000 ,
435
+ originalHeight: 4000 ),
436
+ ]),
437
+ ]);
438
+
439
+ static const imageSingleNoDimensions = ContentExample (
440
+ 'single image no dimensions' ,
424
441
// https://chat.zulip.org/#narrow/stream/7-test-here/topic/Thumbnails/near/1893590
425
442
"[image.jpg](/user_uploads/2/c3/wb9FXk8Ej6qIc28aWKcqUogD/image.jpg)" ,
426
443
'<div class="message_inline_image">'
@@ -429,7 +446,9 @@ class ContentExample {
429
446
ImageNodeList ([
430
447
ImageNode (srcUrl: '/user_uploads/2/c3/wb9FXk8Ej6qIc28aWKcqUogD/image.jpg' ,
431
448
thumbnailUrl: '/user_uploads/thumbnail/2/c3/wb9FXk8Ej6qIc28aWKcqUogD/image.jpg/840x560.webp' ,
432
- loading: false ),
449
+ loading: false ,
450
+ originalWidth: null ,
451
+ originalHeight: null ),
433
452
]),
434
453
]);
435
454
@@ -441,7 +460,8 @@ class ContentExample {
441
460
'<img src="https://chat.zulip.org/user_avatars/2/realm/icon.png?version=3"></a></div>' , [
442
461
ImageNodeList ([
443
462
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png?version=3' ,
444
- thumbnailUrl: null , loading: false ),
463
+ thumbnailUrl: null , loading: false ,
464
+ originalWidth: null , originalHeight: null ),
445
465
]),
446
466
]);
447
467
@@ -454,7 +474,8 @@ class ContentExample {
454
474
'<img class="image-loading-placeholder" src="/static/images/loading/loader-black.svg"></a></div>' , [
455
475
ImageNodeList ([
456
476
ImageNode (srcUrl: '/user_uploads/2/c3/wb9FXk8Ej6qIc28aWKcqUogD/image.jpg' ,
457
- thumbnailUrl: null , loading: true ),
477
+ thumbnailUrl: null , loading: true ,
478
+ originalWidth: null , originalHeight: null ),
458
479
]),
459
480
]);
460
481
@@ -467,7 +488,8 @@ class ContentExample {
467
488
'<img src="/external_content/de28eb3abf4b7786de4545023dc42d434a2ea0c2/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f372f37382f566572726567656e64655f626c6f656d5f76616e5f65656e5f48656c656e69756d5f253237456c5f446f7261646f2532372e5f32322d30372d323032332e5f253238642e6a2e622532392e6a7067"></a></div>' , [
468
489
ImageNodeList ([
469
490
ImageNode (srcUrl: '/external_content/de28eb3abf4b7786de4545023dc42d434a2ea0c2/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f372f37382f566572726567656e64655f626c6f656d5f76616e5f65656e5f48656c656e69756d5f253237456c5f446f7261646f2532372e5f32322d30372d323032332e5f253238642e6a2e622532392e6a7067' ,
470
- thumbnailUrl: null , loading: false ),
491
+ thumbnailUrl: null , loading: false ,
492
+ originalWidth: null , originalHeight: null ),
471
493
]),
472
494
]);
473
495
@@ -478,7 +500,9 @@ class ContentExample {
478
500
'<a href="::not a URL::">'
479
501
'<img src="::not a URL::"></a></div>' , [
480
502
ImageNodeList ([
481
- ImageNode (srcUrl: '::not a URL::' , thumbnailUrl: null , loading: false ),
503
+ ImageNode (srcUrl: '::not a URL::' ,
504
+ thumbnailUrl: null , loading: false ,
505
+ originalWidth: null , originalHeight: null ),
482
506
]),
483
507
]);
484
508
@@ -504,10 +528,14 @@ class ContentExample {
504
528
ImageNodeList ([
505
529
ImageNode (srcUrl: '/user_uploads/2/9b/WkDt2Qsy79iwf3sM9EMp9fYL/image.jpg' ,
506
530
thumbnailUrl: '/user_uploads/thumbnail/2/9b/WkDt2Qsy79iwf3sM9EMp9fYL/image.jpg/840x560.webp' ,
507
- loading: false ),
531
+ loading: false ,
532
+ originalWidth: null ,
533
+ originalHeight: null ),
508
534
ImageNode (srcUrl: '/user_uploads/2/70/pVeI52TwFUEoFE2qT_u9AMCO/image2.jpg' ,
509
535
thumbnailUrl: '/user_uploads/thumbnail/2/70/pVeI52TwFUEoFE2qT_u9AMCO/image2.jpg/840x560.webp' ,
510
- loading: false ),
536
+ loading: false ,
537
+ originalWidth: null ,
538
+ originalHeight: null ),
511
539
]),
512
540
]);
513
541
@@ -531,9 +559,11 @@ class ContentExample {
531
559
]),
532
560
ImageNodeList ([
533
561
ImageNode (srcUrl: 'https://uploads.zulipusercontent.net/f535ba07f95b99a83aa48e44fd62bbb6c6cf6615/68747470733a2f2f636861742e7a756c69702e6f72672f757365725f617661746172732f322f7265616c6d2f69636f6e2e706e673f76657273696f6e3d33' ,
534
- thumbnailUrl: null , loading: false ),
562
+ thumbnailUrl: null , loading: false ,
563
+ originalWidth: null , originalHeight: null ),
535
564
ImageNode (srcUrl: 'https://uploads.zulipusercontent.net/8f63bc2632a0e41be3f457d86c077e61b4a03e7e/68747470733a2f2f636861742e7a756c69702e6f72672f757365725f617661746172732f322f7265616c6d2f69636f6e2e706e673f76657273696f6e3d34' ,
536
- thumbnailUrl: null , loading: false ),
565
+ thumbnailUrl: null , loading: false ,
566
+ originalWidth: null , originalHeight: null ),
537
567
]),
538
568
]);
539
569
@@ -558,9 +588,11 @@ class ContentExample {
558
588
]),
559
589
ImageNodeList ([
560
590
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ,
561
- thumbnailUrl: null , loading: false ),
591
+ thumbnailUrl: null , loading: false ,
592
+ originalWidth: null , originalHeight: null ),
562
593
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2' ,
563
- thumbnailUrl: null , loading: false ),
594
+ thumbnailUrl: null , loading: false ,
595
+ originalWidth: null , originalHeight: null ),
564
596
]),
565
597
ParagraphNode (links: null , nodes: [
566
598
TextNode ('more content' ),
@@ -596,9 +628,11 @@ class ContentExample {
596
628
]),
597
629
ImageNodeList ([
598
630
ImageNode (srcUrl: 'https://uploads.zulipusercontent.net/34b2695ca83af76204b0b25a8f2019ee35ec38fa/68747470733a2f2f656e2e77696b6970656469612e6f72672f7374617469632f696d616765732f69636f6e732f77696b6970656469612e706e67' ,
599
- thumbnailUrl: null , loading: false ),
631
+ thumbnailUrl: null , loading: false ,
632
+ originalWidth: null , originalHeight: null ),
600
633
ImageNode (srcUrl: 'https://uploads.zulipusercontent.net/d200fb112aaccbff9df767373a201fa59601f362/68747470733a2f2f656e2e77696b6970656469612e6f72672f7374617469632f696d616765732f69636f6e732f77696b6970656469612e706e673f763d31' ,
601
- thumbnailUrl: null , loading: false ),
634
+ thumbnailUrl: null , loading: false ,
635
+ originalWidth: null , originalHeight: null ),
602
636
]),
603
637
ParagraphNode (links: null , nodes: [
604
638
TextNode ('Test' ),
@@ -611,9 +645,11 @@ class ContentExample {
611
645
]),
612
646
ImageNodeList ([
613
647
ImageNode (srcUrl: 'https://uploads.zulipusercontent.net/c4db87e81348dac94eacaa966b46d968b34029cc/68747470733a2f2f656e2e77696b6970656469612e6f72672f7374617469632f696d616765732f69636f6e732f77696b6970656469612e706e673f763d32' ,
614
- thumbnailUrl: null , loading: false ),
648
+ thumbnailUrl: null , loading: false ,
649
+ originalWidth: null , originalHeight: null ),
615
650
ImageNode (srcUrl: 'https://uploads.zulipusercontent.net/51b70540cf6a5b3c8a0b919c893b8abddd447e88/68747470733a2f2f656e2e77696b6970656469612e6f72672f7374617469632f696d616765732f69636f6e732f77696b6970656469612e706e673f763d33' ,
616
- thumbnailUrl: null , loading: false ),
651
+ thumbnailUrl: null , loading: false ,
652
+ originalWidth: null , originalHeight: null ),
617
653
]),
618
654
]);
619
655
@@ -628,7 +664,8 @@ class ContentExample {
628
664
ListNode (ListStyle .unordered, [[
629
665
ImageNodeList ([
630
666
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ,
631
- thumbnailUrl: null , loading: false ),
667
+ thumbnailUrl: null , loading: false ,
668
+ originalWidth: null , originalHeight: null ),
632
669
]),
633
670
]]),
634
671
]);
@@ -654,9 +691,11 @@ class ContentExample {
654
691
]),
655
692
ImageNodeList ([
656
693
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ,
657
- thumbnailUrl: null , loading: false ),
694
+ thumbnailUrl: null , loading: false ,
695
+ originalWidth: null , originalHeight: null ),
658
696
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png?version=2' ,
659
- thumbnailUrl: null , loading: false ),
697
+ thumbnailUrl: null , loading: false ,
698
+ originalWidth: null , originalHeight: null ),
660
699
]),
661
700
]]),
662
701
]);
@@ -680,7 +719,8 @@ class ContentExample {
680
719
]),
681
720
const ImageNodeList ([
682
721
ImageNode (srcUrl: 'https://chat.zulip.org/user_avatars/2/realm/icon.png' ,
683
- thumbnailUrl: null , loading: false ),
722
+ thumbnailUrl: null , loading: false ,
723
+ originalWidth: null , originalHeight: null ),
684
724
]),
685
725
blockUnimplemented ('more text' ),
686
726
]]),
@@ -1117,6 +1157,7 @@ void main() {
1117
1157
testParseExample (ContentExample .mathBlockInQuote);
1118
1158
1119
1159
testParseExample (ContentExample .imageSingle);
1160
+ testParseExample (ContentExample .imageSingleNoDimensions);
1120
1161
testParseExample (ContentExample .imageSingleNoThumbnail);
1121
1162
testParseExample (ContentExample .imageSingleLoadingPlaceholder);
1122
1163
testParseExample (ContentExample .imageSingleExternal);
0 commit comments