diff --git a/packages/testsweets/test/extensions/widgets_description_list_extensions_test.dart b/packages/testsweets/test/extensions/widgets_description_list_extensions_test.dart index 77618e9..ab0cf0c 100644 --- a/packages/testsweets/test/extensions/widgets_description_list_extensions_test.dart +++ b/packages/testsweets/test/extensions/widgets_description_list_extensions_test.dart @@ -24,13 +24,16 @@ void main() { ) ]); expect( - result[1].renderPosition, - WidgetPosition( - x: 2, - y: 2, - capturedDeviceHeight: 0, - capturedDeviceWidth: 0, - )); + result[1].renderPosition, + WidgetPosition( + x: 2, + y: 2, + capturedDeviceHeight: 0, + capturedDeviceWidth: 0, + orientation: Orientation.landscape, + active: true, + ), + ); }); }); }); diff --git a/packages/testsweets/test/helpers/test_consts.dart b/packages/testsweets/test/helpers/test_consts.dart index dbd7d82..d82f37c 100644 --- a/packages/testsweets/test/helpers/test_consts.dart +++ b/packages/testsweets/test/helpers/test_consts.dart @@ -78,7 +78,11 @@ final kGeneralInteractionWithZeroOffset = Interaction( originalViewName: 'originalViewName', name: 'widgetName', widgetType: WidgetType.general, - widgetPositions: [WidgetPosition.empty()]); + widgetPositions: [ + WidgetPosition.empty().copyWith( + active: true, + ) + ]); final kGeneralInteraction = Interaction( originalViewName: '/', @@ -123,6 +127,7 @@ final kScrollableInteraction = Interaction( y: 20, capturedDeviceWidth: 0, capturedDeviceHeight: 0, + active: true, ) ], widgetType: WidgetType.scrollable, @@ -138,6 +143,7 @@ final kScrollableInteraction2 = Interaction( y: 25, capturedDeviceWidth: 0, capturedDeviceHeight: 0, + active: true, ) ], widgetType: WidgetType.scrollable, @@ -166,7 +172,12 @@ final kTopLeftVerticalScrollableDescription = ScrollableDescription( axis: Axis.vertical, maxScrollExtentByPixels: 0, scrollExtentByPixels: 100, - rect: SerializableRect.fromPoints(Offset(0, 0), Offset(22, 22))); + rect: SerializableRect.fromPoints( + Offset(0, 0), + Offset( + 22, + 22, + ))); final kFullScreenVerticalScrollableDescription = ScrollableDescription( axis: Axis.vertical, maxScrollExtentByPixels: 2000, diff --git a/packages/testsweets/test/services/scroll_appliance_test.dart b/packages/testsweets/test/services/scroll_appliance_test.dart index 064d684..9e20a40 100644 --- a/packages/testsweets/test/services/scroll_appliance_test.dart +++ b/packages/testsweets/test/services/scroll_appliance_test.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:testsweets/src/services/scroll_appliance.dart'; import 'package:testsweets/testsweets.dart'; @@ -130,24 +131,21 @@ void main() { expect(biggestScroll, kFullScreenVerticalScrollableDescription); }); - test(''' -When moving a touchable that have one externalities from -the top of a list to a normal canvas, - Should remove its externalities''', () { + test( + 'When moving a touchable that have one externalities from the top of a list to a normal canvas, Should remove its externalities', + () { final service = ScrollAppliance(); - final touchableInteractionWithOneExternalities = - kTouchableInteraction.copyWith( - // Changed its position - position: WidgetPosition( - x: 400, - y: 400, - capturedDeviceHeight: 0, - capturedDeviceWidth: 0, - ), - - // This list captured before changing the position - externalities: {kTopLeftVerticalScrollableDescription}, - ); + final touchableInteractionWithOneExternalities = kTouchableInteraction + .updatePosition( + x: 400, + y: 400, + currentWidth: 0, + currentHeight: 0, + orientation: Orientation.portrait, + ) + .copyWith( + // This list captured before changing the position + externalities: {kTopLeftVerticalScrollableDescription}); final result = service.applyScrollableOnInteraction( [kTopLeftVerticalScrollableDescription], diff --git a/packages/testsweets/test/view_models/widget_capture_viewmodel_test.dart b/packages/testsweets/test/view_models/widget_capture_viewmodel_test.dart index 47d1ac1..2ed2077 100644 --- a/packages/testsweets/test/view_models/widget_capture_viewmodel_test.dart +++ b/packages/testsweets/test/view_models/widget_capture_viewmodel_test.dart @@ -124,10 +124,9 @@ When capture a new intercation, Should sync with any scrollable underneath it '' expect(model.captureState, CaptureWidgetState.idle); }); - test('''When in quickPositionEdit mode and user trigger onLongPressUp - without changing the interaction position, - Should call updateWidgetDescription from WidgetCaptureService - with the same interaction without changing its position''', () async { + test( + 'When in quickPositionEdit mode and user trigger onLongPressUp without changing the interaction position, Should call updateWidgetDescription from WidgetCaptureService with the same interaction without changing its position', + () async { final service = getAndRegisterWidgetCaptureService(); final model = _getViewModel(); @@ -141,10 +140,9 @@ When capture a new intercation, Should sync with any scrollable underneath it '' )); }); - test('''When in quickPositionEdit mode and user trigger onLongPressUp - while changeing the widget position to new place, - Should call updateWidgetDescription from WidgetCaptureService - with the interaction new position''', () async { + test( + 'When in quickPositionEdit mode and user trigger onLongPressUp while changeing the widget position to new place,Should call updateWidgetDescription from WidgetCaptureService with the interaction new position', + () async { final service = getAndRegisterWidgetCaptureService(); final model = _getViewModel(); @@ -160,11 +158,12 @@ When capture a new intercation, Should sync with any scrollable underneath it '' await model.onLongPressUp(); - final updatedInteraction = kGeneralInteraction.copyWith( - position: kGeneralInteraction.renderPosition.copyWith( - x: 33.0, - y: 33.0, - ), + final updatedInteraction = kGeneralInteraction.updatePosition( + x: 33, + y: 33, + currentWidth: 0, + currentHeight: 0, + orientation: Orientation.portrait, ); verify(service.updateInteractionInDatabase(