fixed client-reported crashes in the pdf viewer, image picker and prosemirror images, mapped webdav errors to user messages and hardened keychain, cache and push stores against io failures
This commit is contained in:
1 parent
c5592f117b
commit
23e4510bf8
19 files changed
+545
-55
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:marianum_mobile/widget/prosemirror/pm_image_view.dart';
|
||||
|
||||
void main() {
|
||||
group('resolvePmImageWidth', () {
|
||||
test('returns null without a width attribute', () {
|
||||
expect(resolvePmImageWidth(null, 300), isNull);
|
||||
});
|
||||
|
||||
test('returns null for unparseable widths', () {
|
||||
expect(resolvePmImageWidth('auto', 300), isNull);
|
||||
});
|
||||
|
||||
test('resolves px, %, em and rem', () {
|
||||
expect(resolvePmImageWidth('120px', 300), 120);
|
||||
expect(resolvePmImageWidth('50%', 300), 150);
|
||||
expect(resolvePmImageWidth('2em', 300), 32);
|
||||
expect(resolvePmImageWidth('2rem', 300), 32);
|
||||
});
|
||||
|
||||
test('caps at the available width and floors at one pixel', () {
|
||||
expect(resolvePmImageWidth('900px', 300), 300);
|
||||
expect(resolvePmImageWidth('0px', 300), 1);
|
||||
});
|
||||
|
||||
test('survives zero or sub-pixel available width', () {
|
||||
expect(resolvePmImageWidth('50%', 0), isNull);
|
||||
expect(resolvePmImageWidth('120px', 0.5), isNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user