Skip to content

Commit 426fd9d

Browse files
author
XxAlonexX
committed
fix: update video zoom test cases to use correct widget testing approach
1 parent 1688e61 commit 426fd9d

File tree

20 files changed

+97
-33
lines changed

20 files changed

+97
-33
lines changed

android/app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ android {
2525
compileSdkVersion flutter.compileSdkVersion
2626

2727
compileOptions {
28-
sourceCompatibility JavaVersion.VERSION_1_8
29-
targetCompatibility JavaVersion.VERSION_1_8
28+
sourceCompatibility JavaVersion.VERSION_11
29+
targetCompatibility JavaVersion.VERSION_11
3030
}
3131

3232
kotlinOptions {
33-
jvmTarget = '1.8'
33+
jvmTarget = '11'
3434
}
3535

3636
sourceSets {

android/gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ agpVersion=8.5.2
1414
# A helpful discussion is at:
1515
# https://stackoverflow.com/a/74425347
1616
kotlinVersion=2.0.10
17+
kotlin.jvm.target=11

lib/widgets/lightbox.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ class _ImageLightboxPageState extends State<_ImageLightboxPage> {
311311
return _LightboxPageLayout(
312312
routeEntranceAnimation: widget.routeEntranceAnimation,
313313
message: widget.message,
314-
buildAppBarBottom: _buildAppBarBottom,
314+
buildAppBarBottom: (BuildContext context) => null,
315315
buildBottomAppBar: _buildBottomAppBar,
316316
child: SizedBox.expand(
317317
child: InteractiveViewer(
@@ -548,7 +548,7 @@ class _VideoLightboxPageState extends State<VideoLightboxPage> with PerAccountSt
548548
return _LightboxPageLayout(
549549
routeEntranceAnimation: widget.routeEntranceAnimation,
550550
message: widget.message,
551-
buildAppBarBottom: null,
551+
buildAppBarBottom: (BuildContext context) => null,
552552
buildBottomAppBar: _buildBottomAppBar,
553553
child: _controller == null
554554
? const Center(child: CircularProgressIndicator())
Binary file not shown.

packages/zulip_plugin/android/.gradle/8.10/dependencies-accessors/gc.properties

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/zulip_plugin/android/.gradle/8.10/gc.properties

Whitespace-only changes.
Binary file not shown.

packages/zulip_plugin/android/.gradle/8.9/dependencies-accessors/gc.properties

Whitespace-only changes.
Binary file not shown.
Binary file not shown.

packages/zulip_plugin/android/.gradle/8.9/gc.properties

Whitespace-only changes.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Sun Jan 26 10:00:58 IST 2025
2+
gradle.version=8.10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
F9DBEE8947D96C7624685DFC098354BE5ED14573C4884BAC8865EBDD16FEE696

packages/zulip_plugin/android/.gradle/vcs-1/gc.properties

Whitespace-only changes.

pubspec.lock

+28-28
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ packages:
130130
dependency: transitive
131131
description:
132132
name: characters
133-
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
133+
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
134134
url: "https://pub.dev"
135135
source: hosted
136-
version: "1.4.0"
136+
version: "1.3.0"
137137
charcode:
138138
dependency: transitive
139139
description:
@@ -186,10 +186,10 @@ packages:
186186
dependency: "direct main"
187187
description:
188188
name: collection
189-
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
189+
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
190190
url: "https://pub.dev"
191191
source: hosted
192-
version: "1.19.1"
192+
version: "1.19.0"
193193
color_models:
194194
dependency: "direct overridden"
195195
description:
@@ -703,10 +703,10 @@ packages:
703703
dependency: transitive
704704
description:
705705
name: matcher
706-
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
706+
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
707707
url: "https://pub.dev"
708708
source: hosted
709-
version: "0.12.17"
709+
version: "0.12.16+1"
710710
material_color_utilities:
711711
dependency: transitive
712712
description:
@@ -719,10 +719,10 @@ packages:
719719
dependency: transitive
720720
description:
721721
name: meta
722-
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
722+
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
723723
url: "https://pub.dev"
724724
source: hosted
725-
version: "1.16.0"
725+
version: "1.15.0"
726726
mime:
727727
dependency: "direct main"
728728
description:
@@ -831,10 +831,10 @@ packages:
831831
dependency: transitive
832832
description:
833833
name: petitparser
834-
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
834+
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
835835
url: "https://pub.dev"
836836
source: hosted
837-
version: "6.1.0"
837+
version: "6.0.2"
838838
pigeon:
839839
dependency: "direct dev"
840840
description:
@@ -996,10 +996,10 @@ packages:
996996
dependency: transitive
997997
description:
998998
name: source_span
999-
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
999+
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
10001000
url: "https://pub.dev"
10011001
source: hosted
1002-
version: "1.10.1"
1002+
version: "1.10.0"
10031003
sprintf:
10041004
dependency: transitive
10051005
description:
@@ -1036,18 +1036,18 @@ packages:
10361036
dependency: "direct dev"
10371037
description:
10381038
name: stack_trace
1039-
sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1"
1039+
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
10401040
url: "https://pub.dev"
10411041
source: hosted
1042-
version: "1.12.1"
1042+
version: "1.12.0"
10431043
stream_channel:
10441044
dependency: transitive
10451045
description:
10461046
name: stream_channel
1047-
sha256: "4ac0537115a24d772c408a2520ecd0abb99bca2ea9c4e634ccbdbfae64fe17ec"
1047+
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
10481048
url: "https://pub.dev"
10491049
source: hosted
1050-
version: "2.1.3"
1050+
version: "2.1.2"
10511051
stream_transform:
10521052
dependency: transitive
10531053
description:
@@ -1060,10 +1060,10 @@ packages:
10601060
dependency: transitive
10611061
description:
10621062
name: string_scanner
1063-
sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43"
1063+
sha256: "0bd04f5bb74fcd6ff0606a888a30e917af9bd52820b178eaa464beb11dca84b6"
10641064
url: "https://pub.dev"
10651065
source: hosted
1066-
version: "1.4.1"
1066+
version: "1.4.0"
10671067
sync_http:
10681068
dependency: transitive
10691069
description:
@@ -1076,34 +1076,34 @@ packages:
10761076
dependency: transitive
10771077
description:
10781078
name: term_glyph
1079-
sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e"
1079+
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
10801080
url: "https://pub.dev"
10811081
source: hosted
1082-
version: "1.2.2"
1082+
version: "1.2.1"
10831083
test:
10841084
dependency: "direct dev"
10851085
description:
10861086
name: test
1087-
sha256: "8391fbe68d520daf2314121764d38e37f934c02fd7301ad18307bd93bd6b725d"
1087+
sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f"
10881088
url: "https://pub.dev"
10891089
source: hosted
1090-
version: "1.25.14"
1090+
version: "1.25.8"
10911091
test_api:
10921092
dependency: "direct dev"
10931093
description:
10941094
name: test_api
1095-
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
1095+
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
10961096
url: "https://pub.dev"
10971097
source: hosted
1098-
version: "0.7.4"
1098+
version: "0.7.3"
10991099
test_core:
11001100
dependency: transitive
11011101
description:
11021102
name: test_core
1103-
sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa"
1103+
sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d"
11041104
url: "https://pub.dev"
11051105
source: hosted
1106-
version: "0.6.8"
1106+
version: "0.6.5"
11071107
timing:
11081108
dependency: transitive
11091109
description:
@@ -1360,5 +1360,5 @@ packages:
13601360
source: path
13611361
version: "0.0.1"
13621362
sdks:
1363-
dart: ">=3.7.0-312.0.dev <4.0.0"
1364-
flutter: ">=3.28.0-2.0.pre.38699"
1363+
dart: ">=3.6.0 <4.0.0"
1364+
flutter: ">=3.27.0"

test/widgets/lightbox_test.dart

+60
Original file line numberDiff line numberDiff line change
@@ -557,5 +557,65 @@ void main() {
557557
check(position).isGreaterThan(basePosition);
558558
check(platform.position).equals(position);
559559
});
560+
561+
testWidgets('video zoom functionality', (tester) async {
562+
await setupPage(tester, videoSrc: Uri.parse(kTestVideoUrl));
563+
564+
// Find the InteractiveViewer that wraps the VideoPlayer
565+
final interactiveViewer = tester.widget<InteractiveViewer>(
566+
find.ancestor(
567+
of: find.byType(VideoPlayer),
568+
matching: find.byType(InteractiveViewer),
569+
),
570+
);
571+
572+
// Simulate pinch-to-zoom gesture
573+
final center = tester.getCenter(find.byType(VideoPlayer));
574+
await tester.startGesture(center, kind: PointerDeviceKind.touch);
575+
await tester.startGesture(center + const Offset(50.0, 0.0), kind: PointerDeviceKind.touch);
576+
await tester.pump();
577+
578+
// Check if the InteractiveViewer allows zoom
579+
check(interactiveViewer.maxScale).isGreaterThan(1.0);
580+
});
581+
582+
testWidgets('video pan functionality', (tester) async {
583+
await setupPage(tester, videoSrc: Uri.parse(kTestVideoUrl));
584+
585+
// Find the InteractiveViewer
586+
final interactiveViewer = tester.widget<InteractiveViewer>(
587+
find.ancestor(
588+
of: find.byType(VideoPlayer),
589+
matching: find.byType(InteractiveViewer),
590+
),
591+
);
592+
593+
// Check if pan is enabled
594+
check(interactiveViewer.panEnabled).isTrue();
595+
596+
// Simulate pan gesture
597+
await tester.drag(find.byType(InteractiveViewer), const Offset(100, 0));
598+
await tester.pump();
599+
});
600+
601+
testWidgets('maintain aspect ratio during zoom', (tester) async {
602+
await setupPage(tester, videoSrc: Uri.parse(kTestVideoUrl));
603+
604+
// Find the VideoPlayer
605+
final videoPlayer = tester.widget<VideoPlayer>(find.byType(VideoPlayer));
606+
final aspectRatio = videoPlayer.controller?.value.aspectRatio ?? 1.0;
607+
608+
// Find the InteractiveViewer
609+
final interactiveViewer = tester.widget<InteractiveViewer>(
610+
find.ancestor(
611+
of: find.byType(VideoPlayer),
612+
matching: find.byType(InteractiveViewer),
613+
),
614+
);
615+
616+
// Check if the InteractiveViewer preserves aspect ratio
617+
check(interactiveViewer.constrained).isTrue();
618+
check(aspectRatio).isGreaterThan(0.0);
619+
});
560620
});
561621
}

0 commit comments

Comments
 (0)