Skip to content

Commit

Permalink
fix: fix test error and add missing method
Browse files Browse the repository at this point in the history
  • Loading branch information
hyj1204 committed Aug 29, 2023
1 parent 00b8540 commit 759a37c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ class _TableBlockComponentWidgetState extends State<TableBlockComponentWidget>

@override
Offset localToGlobal(Offset offset) => _renderBox.localToGlobal(offset);

@override
Offset globalToLocal(Offset offset) => _renderBox.globalToLocal(offset);
@override
Rect getBlockRect() {
return getRectsInSelection(Selection.invalid()).first;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

Expand Down
8 changes: 4 additions & 4 deletions test/render/selection/mobile_selection_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ void main() {
Stack(
children: [
MobileSelectionWidget(
showLeftHandler: true,
showRightHandler: true,
handleType: HandleType.up,
layerLink: node.layerLink,
rect: const Rect.fromLTWH(0, 0, 100, 100),
color: Colors.red,
selectionRect: const Rect.fromLTWH(0, 0, 100, 100),
selectionColor: Colors.blue,
selectionHandleColor: Colors.red,
),
],
),
Expand Down
16 changes: 8 additions & 8 deletions test/service/mobile_selection_gesture_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:appflowy_editor/src/service/selection/mobile_selection_gesture.dart';
import 'package:appflowy_editor/src/service/selection_gesture_detector/mobile_selection_gesture_detector.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Expand All @@ -15,11 +15,11 @@ void main() {
});

testWidgets('on tap gesture', (tester) async {
bool onTapDown = false;
bool onTap = false;

await tester.buildAndPump(
MobileSelectionGestureDetector(
onTapDown: (_) => onTapDown = true,
onTap: () => onTap = true,
child: const SizedBox.square(dimension: 50),
),
);
Expand All @@ -28,7 +28,7 @@ void main() {
await tester.tap(find.byType(SizedBox), warnIfMissed: false);
await tester.pumpAndSettle();

expect(onTapDown, true);
expect(onTap, true);
});

testWidgets('on double tap gesture', (tester) async {
Expand All @@ -52,12 +52,12 @@ void main() {
expect(onDoubleTapDown, true);
});

testWidgets('on triple tap gesture', (tester) async {
bool onTripleTapDown = false;
testWidgets('on double tap gesture', (tester) async {
bool onDoubleTap = false;

await tester.buildAndPump(
MobileSelectionGestureDetector(
onTripleTapDown: (_) => onTripleTapDown = true,
onDoubleTap: () => onDoubleTap = true,
child: const SizedBox.square(dimension: 50),
),
);
Expand All @@ -73,7 +73,7 @@ void main() {

await tester.pumpAndSettle();

expect(onTripleTapDown, true);
expect(onDoubleTap, true);
});
});
}

0 comments on commit 759a37c

Please sign in to comment.