Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] Make speed chips accessible

r4khul4dbf581aafae
diff --git a/mobile/apps/photos/lib/ui/common/video_speed_options.dart b/mobile/apps/photos/lib/ui/common/video_speed_options.dart
index 1647b4e4c7..6d4f385dce 100644
--- a/mobile/apps/photos/lib/ui/common/video_speed_options.dart
+++ b/mobile/apps/photos/lib/ui/common/video_speed_options.dart
@@ -52,6 +52,7 @@ class _SpeedChip extends StatelessWidget {
selected: isSelected,
label: label,
excludeSemantics: true,
+ onTap: onTap,
child: GestureDetector(
onTap: onTap,
child: Container(
diff --git a/mobile/apps/photos/test/ui/tools/editor/video_speed_options_test.dart b/mobile/apps/photos/test/ui/tools/editor/video_speed_options_test.dart
index c690a614ce..139c81f3fd 100644
--- a/mobile/apps/photos/test/ui/tools/editor/video_speed_options_test.dart
+++ b/mobile/apps/photos/test/ui/tools/editor/video_speed_options_test.dart
@@ -34,4 +34,30 @@ void main() {
0.5,
);
});
+
+ testWidgets('speed chips can be activated through semantics', (tester) async {
+ double selectedSpeed = 1.0;
+
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: darkThemeData,
+ home: Scaffold(
+ body: VideoSpeedOptions(
+ currentSpeed: selectedSpeed,
+ onSpeedSelected: (speed) => selectedSpeed = speed,
+ ),
+ ),
+ ),
+ );
+
+ final chip = tester.widget<Semantics>(
+ find.byWidgetPredicate(
+ (widget) => widget is Semantics && widget.properties.label == '0.5x',
+ ),
+ );
+ expect(chip.properties.button, isTrue);
+ expect(chip.properties.onTap, isNotNull);
+ chip.properties.onTap!();
+ expect(selectedSpeed, 0.5);
+ });
}