update zjs81/dev 724696cd3c and fix image preview position.
This commit is contained in:
1 parent
d920449cbb
commit
6786c3348f
157 files changed
+31310
-1338
No files matched your search
+16
-11
@@ -1,10 +1,10 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_open/helpers/message_image_helper.dart';
|
||||
import 'package:meshcore_open/helpers/message_url_image_helper.dart';
|
||||
|
||||
void main() {
|
||||
group('MessageImageHelper', () {
|
||||
group('MessageUrlImageHelper', () {
|
||||
test('parses short pyx ids', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
final attachment = await MessageUrlImageHelper.parse(
|
||||
'my picture: https://pyx.li/?i=RzmdkTsE text',
|
||||
);
|
||||
|
||||
@@ -13,7 +13,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('parses direct pyx image urls', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
final attachment = await MessageUrlImageHelper.parse(
|
||||
'https://pyx.li/?i=Cd1KFiwu',
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('parses provider-hosted ipfs links', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
final attachment = await MessageUrlImageHelper.parse(
|
||||
'my picture: https://uneven-plum-tarantula.myfilebase.com/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('parses direct ipfs cid urls', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
final attachment = await MessageUrlImageHelper.parse(
|
||||
'my picture: ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('parses http image urls', () async {
|
||||
final attachment = await MessageImageHelper.parse(
|
||||
final attachment = await MessageUrlImageHelper.parse(
|
||||
'see this image https://example.com/picture.png?size=large additional text',
|
||||
);
|
||||
|
||||
@@ -55,19 +55,24 @@ void main() {
|
||||
});
|
||||
|
||||
test('returns null for plain text', () async {
|
||||
expect(await MessageImageHelper.parse('hello world'), isNull);
|
||||
expect(await MessageUrlImageHelper.parse('hello world'), isNull);
|
||||
});
|
||||
|
||||
test('detects supported image URLs without resolving them', () {
|
||||
expect(
|
||||
MessageImageHelper.hasPotentialImageUrl('https://pyx.li/?i=RzmdkTsE'),
|
||||
MessageUrlImageHelper.hasPotentialImageUrl(
|
||||
'https://pyx.li/?i=RzmdkTsE',
|
||||
),
|
||||
isTrue,
|
||||
);
|
||||
expect(MessageImageHelper.hasPotentialImageUrl('hello world'), isFalse);
|
||||
expect(
|
||||
MessageUrlImageHelper.hasPotentialImageUrl('hello world'),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('returns null for non-image ipfs gateway URL', () async {
|
||||
final attachment = await MessageImageHelper.parseVerified(
|
||||
final attachment = await MessageUrlImageHelper.parseVerified(
|
||||
'https://lime-famous-rat-748.mypinata.cloud/ipfs/bafybeih3jqv36rsxqx7yw3k3ixhganrevrk7xmcxgkr2zuzjegxdytb3nq',
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user