diff --git a/lib/core/commands/command_factory/command_factory.dart b/lib/core/commands/command_factory/command_factory.dart index 5b162543..dfc44cf7 100644 --- a/lib/core/commands/command_factory/command_factory.dart +++ b/lib/core/commands/command_factory/command_factory.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/text_command.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_area_command.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_path_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/line_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/path_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/shape/ellipse_shape_command.dart'; @@ -19,6 +21,19 @@ class CommandFactory { ) => PathCommand(path, paint); + ClipPathCommand createClipPathCommand( + PathWithActionHistory path, + Paint paint, { + Offset? startPoint, + Offset? endPoint, + }) => + ClipPathCommand( + path, + paint, + startPoint: startPoint, + endPoint: endPoint, + ); + LineCommand createLineCommand( PathWithActionHistory path, Paint paint, @@ -108,4 +123,10 @@ class CommandFactory { SprayCommand createSprayCommand(List points, Paint paint) { return SprayCommand(points, paint); } + + ClipAreaCommand createClipAreaCommand( + PathWithActionHistory path, + Paint paint, + ) => + ClipAreaCommand(path, paint); } diff --git a/lib/core/commands/command_implementation/command.dart b/lib/core/commands/command_implementation/command.dart index a16e511f..cf143045 100644 --- a/lib/core/commands/command_implementation/command.dart +++ b/lib/core/commands/command_implementation/command.dart @@ -1,4 +1,6 @@ import 'package:equatable/equatable.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_area_command.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_path_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/line_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/path_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/shape/ellipse_shape_command.dart'; @@ -24,12 +26,17 @@ abstract class Command with EquatableMixin { return SquareShapeCommand.fromJson(json); case SerializerType.ELLIPSE_SHAPE_COMMAND: return EllipseShapeCommand.fromJson(json); - case SerializerType.TEXT_COMMAND: - return TextCommand.fromJson(json); case SerializerType.HEART_SHAPE_COMMAND: return HeartShapeCommand.fromJson(json); case SerializerType.STAR_SHAPE_COMMAND: return StarShapeCommand.fromJson(json); + case SerializerType.TEXT_COMMAND: + return TextCommand.fromJson(json); + case SerializerType.CLIP_PATH_COMMAND: + return ClipPathCommand.fromJson(json); + case SerializerType.CLIP_AREA_COMMAND: + return ClipAreaCommand.fromJson(json); + default: return PathCommand.fromJson(json); } diff --git a/lib/core/commands/command_implementation/graphic/clip_area_command.dart b/lib/core/commands/command_implementation/graphic/clip_area_command.dart new file mode 100644 index 00000000..607934d4 --- /dev/null +++ b/lib/core/commands/command_implementation/graphic/clip_area_command.dart @@ -0,0 +1,69 @@ +import 'dart:ui'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/graphic_command.dart'; +import 'package:paintroid/core/commands/path_with_action_history.dart'; +import 'package:paintroid/core/json_serialization/converter/paint_converter.dart'; +import 'package:paintroid/core/json_serialization/converter/path_with_action_history_converter.dart'; +import 'package:paintroid/core/json_serialization/versioning/serializer_version.dart'; +import 'package:paintroid/core/json_serialization/versioning/version_strategy.dart'; + +part 'clip_area_command.g.dart'; + +@JsonSerializable() +class ClipAreaCommand extends GraphicCommand { + @JsonKey(includeToJson: true, includeFromJson: true) + final String type; + @JsonKey(includeToJson: true, includeFromJson: true) + final int version; + + @PathWithActionHistoryConverter() + final PathWithActionHistory clipPathData; + + ClipAreaCommand( + this.clipPathData, + Paint paint, { + this.type = SerializerType.CLIP_AREA_COMMAND, + int? version, + }) : version = version ?? + VersionStrategyManager.strategy.getClipAreaCommandVersion(), + super(paint); + + @override + void call(Canvas canvas) { + final Rect canvasBounds = canvas.getLocalClipBounds(); + + Path areaToClear = Path.combine( + PathOperation.difference, + Path()..addRect(canvasBounds), + clipPathData.path, + ); + + canvas.drawPath( + areaToClear, + Paint() + ..blendMode = BlendMode.clear + ..style = PaintingStyle.fill); + } + + @override + List get props => [paint, clipPathData, type, version]; + + factory ClipAreaCommand.fromJson(Map json) { + int version = json['version'] as int; + + switch (version) { + case Version.v1: + return _$ClipAreaCommandFromJson(json); + case Version.v2: + // For different versions of ClipAreaCommand the deserialization + // has to be implemented manually. + // Autogenerated code can only be used for one version + default: + return _$ClipAreaCommandFromJson(json); + } + } + + @override + Map toJson() => _$ClipAreaCommandToJson(this); +} diff --git a/lib/core/commands/command_implementation/graphic/clip_area_command.g.dart b/lib/core/commands/command_implementation/graphic/clip_area_command.g.dart new file mode 100644 index 00000000..c8c75133 --- /dev/null +++ b/lib/core/commands/command_implementation/graphic/clip_area_command.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'clip_area_command.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ClipAreaCommand _$ClipAreaCommandFromJson(Map json) => + ClipAreaCommand( + const PathWithActionHistoryConverter() + .fromJson(json['clipPathData'] as Map), + const PaintConverter().fromJson(json['paint'] as Map), + type: json['type'] as String? ?? SerializerType.CLIP_AREA_COMMAND, + version: (json['version'] as num?)?.toInt(), + ); + +Map _$ClipAreaCommandToJson(ClipAreaCommand instance) => + { + 'paint': const PaintConverter().toJson(instance.paint), + 'type': instance.type, + 'version': instance.version, + 'clipPathData': + const PathWithActionHistoryConverter().toJson(instance.clipPathData), + }; diff --git a/lib/core/commands/command_implementation/graphic/clip_path_command.dart b/lib/core/commands/command_implementation/graphic/clip_path_command.dart new file mode 100644 index 00000000..5fa3248b --- /dev/null +++ b/lib/core/commands/command_implementation/graphic/clip_path_command.dart @@ -0,0 +1,89 @@ +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/graphic_command.dart'; +import 'package:paintroid/core/commands/path_with_action_history.dart'; +import 'package:paintroid/core/json_serialization/converter/offset_converter.dart'; +import 'package:paintroid/core/json_serialization/converter/path_with_action_history_converter.dart'; +import 'package:paintroid/core/json_serialization/converter/paint_converter.dart'; +import 'package:paintroid/core/json_serialization/versioning/serializer_version.dart'; +import 'package:paintroid/core/json_serialization/versioning/version_strategy.dart'; +import 'package:path_drawing/path_drawing.dart'; + +part 'clip_path_command.g.dart'; + +@JsonSerializable() +class ClipPathCommand extends GraphicCommand { + @JsonKey(includeToJson: true, includeFromJson: true) + final String type; + @JsonKey(includeToJson: true, includeFromJson: true) + final int version; + + @PathWithActionHistoryConverter() + final PathWithActionHistory path; + + @OffsetConverter() + final Offset? startPoint; + @OffsetConverter() + final Offset? endPoint; + + ClipPathCommand( + this.path, + super.paint, { + this.startPoint, + this.endPoint, + this.type = SerializerType.CLIP_PATH_COMMAND, + int? version, + }) : version = version ?? + VersionStrategyManager.strategy.getClipPathCommandVersion(); + + @override + void call(Canvas canvas) { + final dashLength = paint.strokeWidth * 4; + final dashGap = paint.strokeWidth * 2; + + final dashedPath = dashPath( + path.path, + dashArray: CircularIntervalList([dashLength, dashGap]), + ); + canvas.drawPath(dashedPath, paint); + + if (startPoint != null && + endPoint != null && + (startPoint!.dx != endPoint!.dx || startPoint!.dy != endPoint!.dy)) { + final solidPaint = Paint() + ..color = paint.color + ..style = PaintingStyle.stroke + ..strokeWidth = paint.strokeWidth + ..isAntiAlias = true; + + final solidPath = Path() + ..moveTo(startPoint!.dx, startPoint!.dy) + ..lineTo(endPoint!.dx, endPoint!.dy); + + canvas.drawPath(solidPath, solidPaint); + } + } + + @override + List get props => [paint, path, startPoint, endPoint, type, version]; + + factory ClipPathCommand.fromJson(Map json) { + int version = json['version'] as int; + + switch (version) { + case Version.v1: + return _$ClipPathCommandFromJson(json); + case Version.v2: + // For different versions of ClipPathCommand the deserialization + // has to be implemented manually. + // Autogenerated code can only be used for one version + default: + return _$ClipPathCommandFromJson(json); + } + } + + @override + Map toJson() => _$ClipPathCommandToJson(this); +} diff --git a/lib/core/commands/command_implementation/graphic/clip_path_command.g.dart b/lib/core/commands/command_implementation/graphic/clip_path_command.g.dart new file mode 100644 index 00000000..3f88e3d5 --- /dev/null +++ b/lib/core/commands/command_implementation/graphic/clip_path_command.g.dart @@ -0,0 +1,44 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'clip_path_command.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ClipPathCommand _$ClipPathCommandFromJson(Map json) => + ClipPathCommand( + const PathWithActionHistoryConverter() + .fromJson(json['path'] as Map), + const PaintConverter().fromJson(json['paint'] as Map), + startPoint: _$JsonConverterFromJson, Offset>( + json['startPoint'], const OffsetConverter().fromJson), + endPoint: _$JsonConverterFromJson, Offset>( + json['endPoint'], const OffsetConverter().fromJson), + type: json['type'] as String? ?? SerializerType.CLIP_PATH_COMMAND, + version: (json['version'] as num?)?.toInt(), + ); + +Map _$ClipPathCommandToJson(ClipPathCommand instance) => + { + 'paint': const PaintConverter().toJson(instance.paint), + 'type': instance.type, + 'version': instance.version, + 'path': const PathWithActionHistoryConverter().toJson(instance.path), + 'startPoint': _$JsonConverterToJson, Offset>( + instance.startPoint, const OffsetConverter().toJson), + 'endPoint': _$JsonConverterToJson, Offset>( + instance.endPoint, const OffsetConverter().toJson), + }; + +Value? _$JsonConverterFromJson( + Object? json, + Value? Function(Json json) fromJson, +) => + json == null ? null : fromJson(json as Json); + +Json? _$JsonConverterToJson( + Value? value, + Json? Function(Value value) toJson, +) => + value == null ? null : toJson(value); diff --git a/lib/core/commands/command_manager/command_manager.dart b/lib/core/commands/command_manager/command_manager.dart index e8ca6e25..6a3319bb 100644 --- a/lib/core/commands/command_manager/command_manager.dart +++ b/lib/core/commands/command_manager/command_manager.dart @@ -1,6 +1,8 @@ import 'dart:ui'; import 'package:paintroid/core/commands/command_implementation/command.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_area_command.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_path_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/text_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/graphic_command.dart'; import 'package:paintroid/core/commands/command_implementation/graphic/line_command.dart'; @@ -26,13 +28,19 @@ class CommandManager { _undoStack.add(command); } + void removeCommand(Command commandToRemove) { + _undoStack.remove(commandToRemove); + } + void setUndoStack(List commands) { _undoStack.clear(); _undoStack.addAll(commands); } void executeLastCommand(Canvas canvas) { - if (_undoStack.isEmpty) return; + if (_undoStack.isEmpty) { + return; + } final lastCommand = _undoStack.last; if (lastCommand is GraphicCommand) { lastCommand.call(canvas); @@ -48,7 +56,9 @@ class CommandManager { } void discardLastCommand() { - if (_undoStack.isNotEmpty) _undoStack.removeLast(); + if (_undoStack.isNotEmpty) { + _undoStack.removeLast(); + } } void clearUndoStack({Iterable? newCommands}) { @@ -120,6 +130,9 @@ class CommandManager { return ToolData.TEXT; } else if (command.runtimeType == SprayCommand) { return ToolData.SPRAY; + } else if (command.runtimeType == ClipAreaCommand || + command.runtimeType == ClipPathCommand) { + return ToolData.CLIPPING; } else if (command.runtimeType == StarShapeCommand) { return ToolData.SHAPES; } else if (command.runtimeType == HeartShapeCommand) { diff --git a/lib/core/json_serialization/versioning/serializer_version.dart b/lib/core/json_serialization/versioning/serializer_version.dart index 1d7e8a5b..b8f701c2 100644 --- a/lib/core/json_serialization/versioning/serializer_version.dart +++ b/lib/core/json_serialization/versioning/serializer_version.dart @@ -9,6 +9,8 @@ class SerializerVersion { static const int STAR_SHAPE_COMMAND_VERSION = Version.v1; static const int HEART_SHAPE_COMMAND_VERSION = Version.v1; static const int SPRAY_COMMAND_VERSION = Version.v1; + static const int CLIP_PATH_COMMAND_VERSION = Version.v1; + static const int CLIP_AREA_COMMAND_VERSION = Version.v1; } class Version { @@ -29,4 +31,6 @@ class SerializerType { static const String STAR_SHAPE_COMMAND = 'StarShapeCommand'; static const String HEART_SHAPE_COMMAND = 'HeartShapeCommand'; static const String SPRAY_COMMAND = 'SprayCommand'; + static const String CLIP_PATH_COMMAND = 'ClipPathCommand'; + static const String CLIP_AREA_COMMAND = 'ClipAreaCommand'; } diff --git a/lib/core/json_serialization/versioning/version_strategy.dart b/lib/core/json_serialization/versioning/version_strategy.dart index 36d75330..759b15b3 100644 --- a/lib/core/json_serialization/versioning/version_strategy.dart +++ b/lib/core/json_serialization/versioning/version_strategy.dart @@ -18,6 +18,10 @@ abstract class IVersionStrategy { int getHeartShapeCommandVersion(); int getSprayCommandVersion(); + + int getClipPathCommandVersion(); + + int getClipAreaCommandVersion(); } class ProductionVersionStrategy implements IVersionStrategy { @@ -51,6 +55,14 @@ class ProductionVersionStrategy implements IVersionStrategy { @override int getSprayCommandVersion() => SerializerVersion.SPRAY_COMMAND_VERSION; + + @override + int getClipPathCommandVersion() => + SerializerVersion.CLIP_PATH_COMMAND_VERSION; + + @override + int getClipAreaCommandVersion() => + SerializerVersion.CLIP_AREA_COMMAND_VERSION; } class VersionStrategyManager { diff --git a/lib/core/providers/object/tools/clipping_tool_provider.dart b/lib/core/providers/object/tools/clipping_tool_provider.dart new file mode 100644 index 00000000..402b5faa --- /dev/null +++ b/lib/core/providers/object/tools/clipping_tool_provider.dart @@ -0,0 +1,26 @@ +import 'package:riverpod_annotation/riverpod_annotation.dart'; + +import 'package:paintroid/core/commands/command_factory/command_factory_provider.dart'; +import 'package:paintroid/core/commands/command_manager/command_manager_provider.dart'; +import 'package:paintroid/core/commands/graphic_factory/graphic_factory_provider.dart'; +import 'package:paintroid/core/enums/tool_types.dart'; +import 'package:paintroid/core/tools/implementation/clipping_tool.dart'; +import 'package:paintroid/core/providers/object/tools/clipping_tool_state_provider.dart'; +import 'package:paintroid/core/providers/state/canvas_state_provider.dart'; + +part 'clipping_tool_provider.g.dart'; + +@riverpod +class ClippingToolProvider extends _$ClippingToolProvider { + @override + ClippingTool build() { + return ClippingTool( + commandManager: ref.watch(commandManagerProvider), + commandFactory: ref.watch(commandFactoryProvider), + graphicFactory: ref.watch(graphicFactoryProvider), + clippingToolState: ref.watch(clippingToolState.notifier), + canvasStateProvider: ref.watch(canvasStateProvider.notifier), + type: ToolType.CLIPPING, + ); + } +} diff --git a/lib/core/providers/object/tools/clipping_tool_provider.g.dart b/lib/core/providers/object/tools/clipping_tool_provider.g.dart new file mode 100644 index 00000000..f46fddd5 --- /dev/null +++ b/lib/core/providers/object/tools/clipping_tool_provider.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'clipping_tool_provider.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +String _$clippingToolProviderHash() => + r'10381b6a787aef98e726b246d488001814bcb1e5'; + +/// See also [ClippingToolProvider]. +@ProviderFor(ClippingToolProvider) +final clippingToolProvider = + AutoDisposeNotifierProvider.internal( + ClippingToolProvider.new, + name: r'clippingToolProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$clippingToolProviderHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef _$ClippingToolProvider = AutoDisposeNotifier; +// ignore_for_file: type=lint +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/core/providers/object/tools/clipping_tool_state_provider.dart b/lib/core/providers/object/tools/clipping_tool_state_provider.dart new file mode 100644 index 00000000..203d4381 --- /dev/null +++ b/lib/core/providers/object/tools/clipping_tool_state_provider.dart @@ -0,0 +1,21 @@ +import 'package:riverpod_annotation/riverpod_annotation.dart'; + +part 'clipping_tool_state_provider.g.dart'; + +@riverpod +class ClippingToolState extends _$ClippingToolState { + @override + bool build() { + return false; + } + + void setHasActiveClipPath(bool hasActive) { + state = hasActive; + } + + void clearClipPath() { + state = false; + } + + bool get hasActiveClipPath => state; +} diff --git a/lib/core/providers/object/tools/clipping_tool_state_provider.g.dart b/lib/core/providers/object/tools/clipping_tool_state_provider.g.dart new file mode 100644 index 00000000..8cf879e7 --- /dev/null +++ b/lib/core/providers/object/tools/clipping_tool_state_provider.g.dart @@ -0,0 +1,26 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'clipping_tool_state_provider.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +String _$clippingToolStateHash() => r'd6a9d9e023dc616a6a7eb99c55b38590d14b2311'; + +/// See also [ClippingToolState]. +@ProviderFor(ClippingToolState) +final clippingToolState = + AutoDisposeNotifierProvider.internal( + ClippingToolState.new, + name: r'clippingToolState', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$clippingToolStateHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef _$ClippingToolState = AutoDisposeNotifier; +// ignore_for_file: type=lint +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/core/providers/state/toolbox_state_provider.dart b/lib/core/providers/state/toolbox_state_provider.dart index bd4f0dd6..bccae8ac 100644 --- a/lib/core/providers/state/toolbox_state_provider.dart +++ b/lib/core/providers/state/toolbox_state_provider.dart @@ -4,6 +4,7 @@ import 'package:paintroid/core/commands/command_manager/command_manager_provider import 'package:paintroid/core/enums/tool_types.dart'; import 'package:paintroid/core/providers/object/canvas_painter_provider.dart'; import 'package:paintroid/core/providers/object/tools/brush_tool_provider.dart'; +import 'package:paintroid/core/providers/object/tools/clipping_tool_provider.dart'; import 'package:paintroid/core/providers/object/tools/eraser_tool_provider.dart'; import 'package:paintroid/core/providers/object/tools/hand_tool_provider.dart'; import 'package:paintroid/core/providers/object/tools/line_tool_provider.dart'; @@ -85,6 +86,9 @@ class ToolBoxStateProvider extends _$ToolBoxStateProvider { (state.currentTool as SprayTool).updateSprayRadius(currentStrokeWidth); ref.read(paintProvider.notifier).updateStrokeWidth(SPRAY_TOOL_RADIUS); break; + case ToolType.CLIPPING: + state = state.copyWith(currentTool: ref.read(clippingToolProvider)); + break; default: state = state.copyWith(currentTool: ref.read(brushToolProvider)); break; diff --git a/lib/core/providers/state/toolbox_state_provider.g.dart b/lib/core/providers/state/toolbox_state_provider.g.dart index 4ad281ca..43a6a5c3 100644 --- a/lib/core/providers/state/toolbox_state_provider.g.dart +++ b/lib/core/providers/state/toolbox_state_provider.g.dart @@ -7,7 +7,7 @@ part of 'toolbox_state_provider.dart'; // ************************************************************************** String _$toolBoxStateProviderHash() => - r'287ea0cf348a191887971afc63b94e77ffd3d24b'; + r'74dbcf24da621e085b48585c2bca05fa09cda326'; /// See also [ToolBoxStateProvider]. @ProviderFor(ToolBoxStateProvider) diff --git a/lib/core/tools/implementation/clipping_tool.dart b/lib/core/tools/implementation/clipping_tool.dart new file mode 100644 index 00000000..f7187ace --- /dev/null +++ b/lib/core/tools/implementation/clipping_tool.dart @@ -0,0 +1,227 @@ +import 'dart:ui'; + +import 'package:flutter/foundation.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/graphic_command.dart'; +import 'package:paintroid/core/commands/graphic_factory/graphic_factory.dart'; +import 'package:paintroid/core/commands/path_with_action_history.dart'; +import 'package:paintroid/core/providers/state/canvas_state_provider.dart'; +import 'package:paintroid/core/tools/tool.dart'; +import 'package:paintroid/core/enums/tool_types.dart'; +import 'package:paintroid/core/providers/object/tools/clipping_tool_state_provider.dart'; + +class ClippingTool extends Tool { + final GraphicFactory graphicFactory; + final ClippingToolState clippingToolState; + final CanvasStateProvider canvasStateProvider; + + @visibleForTesting + late PathWithActionHistory pathToDraw; + Offset? _startPoint; + GraphicCommand? _activePreviewCommand; + GraphicCommand? _liveDrawingCommand; + + ClippingTool({ + required super.commandFactory, + required super.commandManager, + required this.graphicFactory, + required this.clippingToolState, + required this.canvasStateProvider, + super.type = ToolType.CLIPPING, + super.hasAddFunctionality = false, + super.hasFinalizeFunctionality = true, + }); + + @override + void onDown(Offset point, Paint paint) { + bool requiresRefresh = false; + if (clippingToolState.hasActiveClipPath) { + if (_activePreviewCommand != null) { + commandManager.removeCommand(_activePreviewCommand!); + _activePreviewCommand = null; + requiresRefresh = true; + } + clippingToolState.clearClipPath(); + } + + if (_liveDrawingCommand != null) { + commandManager.removeCommand(_liveDrawingCommand!); + _liveDrawingCommand = null; + requiresRefresh = true; + } + + if (requiresRefresh) { + canvasStateProvider.resetCanvasWithExistingCommands(); + } + + _startPoint = point; + pathToDraw = graphicFactory.createPathWithActionHistory() + ..moveTo(point.dx, point.dy); + + final newLiveDrawingCommand = + commandFactory.createClipPathCommand(pathToDraw, paint); + commandManager.addGraphicCommand(newLiveDrawingCommand); + _liveDrawingCommand = newLiveDrawingCommand; + } + + @override + void onDrag(Offset point, Paint paint) { + pathToDraw.lineTo(point.dx, point.dy); + } + + @override + void onUp(Offset point, Paint paint) { + bool requiresRefresh = false; + if (_liveDrawingCommand != null) { + commandManager.removeCommand(_liveDrawingCommand!); + _liveDrawingCommand = null; + requiresRefresh = true; + } + + bool pointAddedInUp = false; + if (pathToDraw.actions.isNotEmpty) { + final lastAction = pathToDraw.actions.last; + bool isSameAsLastPoint = false; + + if (lastAction is LineToAction) { + isSameAsLastPoint = + (lastAction.x == point.dx && lastAction.y == point.dy); + } else if (lastAction is MoveToAction && pathToDraw.actions.length == 1) { + isSameAsLastPoint = + (lastAction.x == point.dx && lastAction.y == point.dy); + } + + if (!isSameAsLastPoint) { + pathToDraw.lineTo(point.dx, point.dy); + pointAddedInUp = true; + } + } else { + pathToDraw.moveTo(point.dx, point.dy); + pathToDraw.lineTo(point.dx, point.dy); + pointAddedInUp = true; + } + + Offset currentEndPoint = point; + if (pathToDraw.actions.isNotEmpty) { + if (pathToDraw.actions.last is LineToAction) { + final lastLineTo = pathToDraw.actions.last as LineToAction; + currentEndPoint = Offset(lastLineTo.x, lastLineTo.y); + } else if (pathToDraw.actions.last is MoveToAction) { + final lastMoveTo = pathToDraw.actions.last as MoveToAction; + currentEndPoint = Offset(lastMoveTo.x, lastMoveTo.y); + } + } + + GraphicCommand newPreviewCommand; + if (_startPoint != null && pathToDraw.actions.isNotEmpty) { + bool needsSolidClosingLine = !(currentEndPoint.dx == _startPoint!.dx && + currentEndPoint.dy == _startPoint!.dy); + + bool isEffectivelySingleTap = + pathToDraw.actions.length <= (pointAddedInUp ? 2 : 1) && + (currentEndPoint.dx == _startPoint!.dx && + currentEndPoint.dy == _startPoint!.dy); + + if (needsSolidClosingLine && !isEffectivelySingleTap) { + newPreviewCommand = commandFactory.createClipPathCommand( + pathToDraw, + paint, + startPoint: currentEndPoint, + endPoint: _startPoint!, + ); + } else { + pathToDraw.close(); + newPreviewCommand = commandFactory.createClipPathCommand( + pathToDraw, + paint, + ); + } + } else { + pathToDraw.close(); + newPreviewCommand = commandFactory.createClipPathCommand( + pathToDraw, + paint, + ); + } + commandManager.addGraphicCommand(newPreviewCommand); + _activePreviewCommand = newPreviewCommand; + clippingToolState.setHasActiveClipPath(true); + _startPoint = null; + + if (requiresRefresh) { + canvasStateProvider.resetCanvasWithExistingCommands(); + } + canvasStateProvider.updateCachedImage(); + } + + @override + void onCancel() { + bool requiresRefresh = false; + if (_liveDrawingCommand != null) { + commandManager.removeCommand(_liveDrawingCommand!); + _liveDrawingCommand = null; + requiresRefresh = true; + } + + if (clippingToolState.hasActiveClipPath) { + if (_activePreviewCommand != null) { + commandManager.removeCommand(_activePreviewCommand!); + _activePreviewCommand = null; + requiresRefresh = true; + } + clippingToolState.clearClipPath(); + } + + if (requiresRefresh) { + canvasStateProvider.resetCanvasWithExistingCommands(); + } + _startPoint = null; + } + + @override + void onCheckmark(Paint paint) { + bool requiresRefresh = false; + if (clippingToolState.hasActiveClipPath) { + if (_activePreviewCommand != null) { + commandManager.removeCommand(_activePreviewCommand!); + _activePreviewCommand = null; + requiresRefresh = true; + } + clippingToolState.clearClipPath(); + } + + if (_liveDrawingCommand != null) { + commandManager.removeCommand(_liveDrawingCommand!); + _liveDrawingCommand = null; + requiresRefresh = true; + } + + if (pathToDraw.actions.isNotEmpty) { + pathToDraw.close(); + + final cropCommand = + commandFactory.createClipAreaCommand(pathToDraw, paint); + commandManager.addGraphicCommand(cropCommand); + requiresRefresh = true; + } + + if (requiresRefresh) { + canvasStateProvider.resetCanvasWithExistingCommands(); + } + _startPoint = null; + } + + @override + void onPlus() {} + + @override + void onRedo() { + commandManager.redo(); + canvasStateProvider.resetCanvasWithExistingCommands(); + } + + @override + void onUndo() { + commandManager.undo(); + canvasStateProvider.resetCanvasWithExistingCommands(); + } +} diff --git a/lib/ui/pages/workspace_page/components/bottom_bar/tool_options/tool_options.dart b/lib/ui/pages/workspace_page/components/bottom_bar/tool_options/tool_options.dart index ad8b99f2..cffd7ec6 100644 --- a/lib/ui/pages/workspace_page/components/bottom_bar/tool_options/tool_options.dart +++ b/lib/ui/pages/workspace_page/components/bottom_bar/tool_options/tool_options.dart @@ -37,6 +37,7 @@ class ToolOptions extends ConsumerWidget { ToolType.SHAPES => const ShapesToolOptions(), ToolType.SPRAY => const SprayToolOptions(), ToolType.TEXT => const TextToolOptions(), + ToolType.CLIPPING => const StrokeToolOptions(), _ => Container(), }, ), diff --git a/lib/ui/pages/workspace_page/components/top_bar/top_app_bar.dart b/lib/ui/pages/workspace_page/components/top_bar/top_app_bar.dart index 319a2f39..e0039ff7 100644 --- a/lib/ui/pages/workspace_page/components/top_bar/top_app_bar.dart +++ b/lib/ui/pages/workspace_page/components/top_bar/top_app_bar.dart @@ -74,7 +74,7 @@ class TopAppBar extends ConsumerWidget implements PreferredSizeWidget { currentTool is LineTool && currentTool.vertexStack.isNotEmpty; final isShapeTool = currentTool.type == ToolType.SHAPES; final isTextTool = currentTool is TextTool; - if (isLineTool || isShapeTool || isTextTool) { + if (isLineTool || isShapeTool || isTextTool || currentTool.type == ToolType.CLIPPING) { return () { currentTool.onCheckmark(ref.read(paintProvider)); ref.read(appBarProvider.notifier).update(); diff --git a/test/integration/clipping_tool_test.dart b/test/integration/clipping_tool_test.dart new file mode 100644 index 00000000..ad9310b5 --- /dev/null +++ b/test/integration/clipping_tool_test.dart @@ -0,0 +1,140 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:paintroid/app.dart'; +import 'package:paintroid/core/tools/tool_data.dart'; +import 'package:paintroid/core/utils/color_utils.dart'; + +import '../utils/canvas_positions.dart'; +import '../utils/ui_interaction.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + const String testIDStr = String.fromEnvironment('id', defaultValue: '-1'); + final testID = int.tryParse(testIDStr) ?? testIDStr; + + late Widget sut; + + setUp(() async { + sut = ProviderScope( + child: App( + showOnboardingPage: false, + ), + ); + }); + + if (testID == -1 || testID == 0) { + testWidgets('[CLIPPING_TOOL]: clip a part of the image', + (WidgetTester tester) async { + UIInteraction.initialize(tester); + await tester.pumpWidget(sut); + await UIInteraction.createNewImage(); + UIInteraction.setColor(Colors.black); + await UIInteraction.selectTool(ToolData.BRUSH.name); + + await UIInteraction.dragFromTo( + CanvasPosition.topLeft, + CanvasPosition.bottomRight, + ); + + await UIInteraction.selectTool(ToolData.CLIPPING.name); + + final Offset center = CanvasPosition.center; + final Offset p1 = center + const Offset(-50, -50); + final Offset p2 = center + const Offset(50, -50); + final Offset p3 = center + const Offset(50, 50); + final Offset p4 = center + const Offset(-50, 50); + + final TestGesture gesture = await tester.startGesture(p1); + await tester.pumpAndSettle(); + await gesture.moveTo(p2); + await tester.pumpAndSettle(); + await gesture.moveTo(p3); + await tester.pumpAndSettle(); + await gesture.moveTo(p4); + await tester.pumpAndSettle(); + await gesture.moveTo(p1); + await tester.pumpAndSettle(); + await gesture.up(); + await tester.pumpAndSettle(); + + await UIInteraction.clickCheckmark(); + + var centerColor = await UIInteraction.getPixelColor( + CanvasPosition.centerX, + CanvasPosition.centerY, + ); + expect(centerColor.toValue(), Colors.black.toValue()); + + var topLeftColor = await UIInteraction.getPixelColor( + CanvasPosition.left, + CanvasPosition.top, + ); + expect(topLeftColor.toValue(), Colors.transparent.toValue()); + + var bottomRightColor = await UIInteraction.getPixelColor( + CanvasPosition.right, + CanvasPosition.bottom, + ); + expect(bottomRightColor.toValue(), Colors.transparent.toValue()); + }); + } + + if (testID == -1 || testID == 1) { + testWidgets('[CLIPPING_TOOL]: cancel clipping', + (WidgetTester tester) async { + UIInteraction.initialize(tester); + await tester.pumpWidget(sut); + await UIInteraction.createNewImage(); + UIInteraction.setColor(Colors.black); + await UIInteraction.selectTool(ToolData.BRUSH.name); + + await UIInteraction.dragFromTo( + CanvasPosition.topLeft, + CanvasPosition.bottomRight, + ); + + await UIInteraction.selectTool(ToolData.CLIPPING.name); + + final Offset center = CanvasPosition.center; + final Offset p1 = center + const Offset(-50, -50); + final Offset p2 = center + const Offset(50, -50); + final Offset p3 = center + const Offset(50, 50); + final Offset p4 = center + const Offset(-50, 50); + + final TestGesture gesture = await tester.startGesture(p1); + await tester.pumpAndSettle(); + await gesture.moveTo(p2); + await tester.pumpAndSettle(); + await gesture.moveTo(p3); + await tester.pumpAndSettle(); + await gesture.moveTo(p4); + await tester.pumpAndSettle(); + await gesture.moveTo(p1); + await tester.pumpAndSettle(); + await gesture.up(); + await tester.pumpAndSettle(); + await UIInteraction.clickBackButton(); + + var centerColor = await UIInteraction.getPixelColor( + CanvasPosition.centerX, + CanvasPosition.centerY, + ); + expect(centerColor.toValue(), Colors.black.toValue()); + + var topLeftColor = await UIInteraction.getPixelColor( + CanvasPosition.left, + CanvasPosition.top, + ); + expect(topLeftColor.toValue(), Colors.black.toValue()); + + var bottomRightColor = await UIInteraction.getPixelColor( + CanvasPosition.right, + CanvasPosition.bottom, + ); + expect(bottomRightColor.toValue(), Colors.black.toValue()); + }); + } +} diff --git a/test/unit/serialization/utils/dummy_version_strategy.dart b/test/unit/serialization/utils/dummy_version_strategy.dart index 2c5246b6..cbbac67a 100644 --- a/test/unit/serialization/utils/dummy_version_strategy.dart +++ b/test/unit/serialization/utils/dummy_version_strategy.dart @@ -11,6 +11,8 @@ class DummyVersionStrategy implements IVersionStrategy { final int heartShapeCommandVersion; final int sprayCommandVersion; final int textCommandVersion; + final int clipPathCommandVersion; + final int clipAreaCommandVersion; DummyVersionStrategy({ this.pathCommandVersion = SerializerVersion.PATH_COMMAND_VERSION, @@ -25,6 +27,8 @@ class DummyVersionStrategy implements IVersionStrategy { SerializerVersion.HEART_SHAPE_COMMAND_VERSION, this.sprayCommandVersion = SerializerVersion.SPRAY_COMMAND_VERSION, this.textCommandVersion = SerializerVersion.TEXT_COMMAND_VERSION, + this.clipPathCommandVersion = SerializerVersion.CLIP_PATH_COMMAND_VERSION, + this.clipAreaCommandVersion = SerializerVersion.CLIP_AREA_COMMAND_VERSION, }); @override @@ -53,4 +57,10 @@ class DummyVersionStrategy implements IVersionStrategy { @override int getTextCommandVersion() => textCommandVersion; + + @override + int getClipPathCommandVersion() => clipPathCommandVersion; + + @override + int getClipAreaCommandVersion() => clipAreaCommandVersion; } diff --git a/test/unit/tools/clipping_tool_test.dart b/test/unit/tools/clipping_tool_test.dart new file mode 100644 index 00000000..4fc4c46f --- /dev/null +++ b/test/unit/tools/clipping_tool_test.dart @@ -0,0 +1,206 @@ +import 'dart:ui'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/mockito.dart'; +import 'package:paintroid/core/commands/command_factory/command_factory.dart'; +import 'package:mockito/annotations.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_area_command.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_path_command.dart'; +import 'package:paintroid/core/commands/command_implementation/graphic/graphic_command.dart'; +import 'package:paintroid/core/commands/graphic_factory/graphic_factory.dart'; +import 'package:paintroid/core/commands/path_with_action_history.dart'; +import 'package:paintroid/core/providers/state/canvas_state_provider.dart'; +import 'package:paintroid/core/tools/implementation/clipping_tool.dart'; +import 'package:paintroid/core/providers/object/tools/clipping_tool_state_provider.dart'; +import 'package:paintroid/core/commands/command_manager/command_manager.dart'; + +import 'clipping_tool_test.mocks.dart'; + +@GenerateMocks([ + CommandManager, + CommandFactory, + GraphicFactory, + GraphicCommand, + CanvasStateProvider, + ClippingToolState, + PathWithActionHistory, + ClipPathCommand, + ClipAreaCommand, +]) +void main() { + late MockCommandManager commandManager; + late MockCommandFactory commandFactory; + late MockGraphicFactory graphicFactory; + late MockCanvasStateProvider canvasStateProvider; + late MockClippingToolState clippingToolState; + late MockPathWithActionHistory pathMock; + late ClippingTool clippingTool; + late Paint paint; + + setUp(() { + commandManager = MockCommandManager(); + commandFactory = MockCommandFactory(); + graphicFactory = MockGraphicFactory(); + canvasStateProvider = MockCanvasStateProvider(); + clippingToolState = MockClippingToolState(); + pathMock = MockPathWithActionHistory(); + paint = Paint(); + + when(graphicFactory.createPathWithActionHistory()).thenReturn(pathMock); + + when(commandFactory.createClipPathCommand(any, any, + startPoint: anyNamed('startPoint'), endPoint: anyNamed('endPoint'))) + .thenAnswer((_) => MockClipPathCommand()); + when(commandFactory.createClipPathCommand(any, any)) + .thenAnswer((_) => MockClipPathCommand()); + when(commandFactory.createClipAreaCommand(any, any)) + .thenAnswer((_) => MockClipAreaCommand()); + + when(clippingToolState.hasActiveClipPath).thenReturn(false); + when(pathMock.actions).thenReturn([MoveToAction(0, 0)]); + + clippingTool = ClippingTool( + commandFactory: commandFactory, + commandManager: commandManager, + graphicFactory: graphicFactory, + clippingToolState: clippingToolState, + canvasStateProvider: canvasStateProvider, + ); + }); + + group('[CLIPPING_TOOL]: onDown', () { + test( + '[CLIPPING_TOOL]: creates a live drawing command when no active clip path', + () { + when(clippingToolState.hasActiveClipPath).thenReturn(false); + clippingTool.onDown(const Offset(10, 20), paint); + + verify(graphicFactory.createPathWithActionHistory()).called(1); + verify(commandFactory.createClipPathCommand(pathMock, paint)).called(1); + final captured = + verify(commandManager.addGraphicCommand(captureAny)).captured; + expect(captured.single, isA()); + + verifyNever(commandManager.removeCommand(any)); + verifyNever(canvasStateProvider.resetCanvasWithExistingCommands()); + }); + + test( + '[CLIPPING_TOOL]: clears existing preview and creates live drawing command when active clip path exists', + () { + clippingTool.onDown(const Offset(5, 5), paint); + clippingTool.onUp(const Offset(10, 10), paint); + + clearInteractions(commandManager); + clearInteractions(commandFactory); + clearInteractions(graphicFactory); + clearInteractions(canvasStateProvider); + clearInteractions(clippingToolState); + + when(graphicFactory.createPathWithActionHistory()).thenReturn(pathMock); + when(commandFactory.createClipPathCommand(any, any)) + .thenAnswer((_) => MockClipPathCommand()); + when(clippingToolState.hasActiveClipPath).thenReturn(true); + + clippingTool.onDown(const Offset(30, 40), paint); + + final capturedRemove = + verify(commandManager.removeCommand(captureAny)).captured; + expect(capturedRemove.single, isA()); + + verify(clippingToolState.clearClipPath()).called(1); + verify(canvasStateProvider.resetCanvasWithExistingCommands()).called(1); + + verify(graphicFactory.createPathWithActionHistory()).called(1); + verify(commandFactory.createClipPathCommand(pathMock, paint)).called(1); + + final capturedAdd = + verify(commandManager.addGraphicCommand(captureAny)).captured; + expect(capturedAdd.single, isA()); + }); + }); + + test( + '[CLIPPING_TOOL]: onUp removes live command, creates and adds preview command', + () { + when(pathMock.actions).thenReturn([MoveToAction(5, 5)]); + + clippingTool.onDown(const Offset(5, 5), paint); + + clearInteractions(commandManager); + clearInteractions(clippingToolState); + clearInteractions(canvasStateProvider); + clearInteractions(commandFactory); + + when(commandFactory.createClipPathCommand(any, any, + startPoint: anyNamed('startPoint'), endPoint: anyNamed('endPoint'))) + .thenAnswer((_) => MockClipPathCommand()); + + clippingTool.onUp(const Offset(15, 15), paint); + + final capturedRemove = + verify(commandManager.removeCommand(captureAny)).captured; + expect(capturedRemove.single, isA()); + + verify(commandFactory.createClipPathCommand(pathMock, paint, + startPoint: anyNamed('startPoint'), endPoint: anyNamed('endPoint'))) + .called(1); + final capturedAdd = + verify(commandManager.addGraphicCommand(captureAny)).captured; + expect(capturedAdd.single, isA()); + + verify(clippingToolState.setHasActiveClipPath(true)).called(1); + verify(canvasStateProvider.resetCanvasWithExistingCommands()).called(1); + verify(canvasStateProvider.updateCachedImage()).called(1); + }); + + test('[CLIPPING_TOOL]: onCancel clears live and preview commands', () { + clippingTool.onDown(const Offset(1, 1), paint); + clippingTool.onUp(const Offset(2, 2), paint); + + clearInteractions(commandManager); + clearInteractions(clippingToolState); + clearInteractions(canvasStateProvider); + + when(clippingToolState.hasActiveClipPath).thenReturn(true); + + clippingTool.onCancel(); + + final capturedRemove = + verify(commandManager.removeCommand(captureAny)).captured; + expect(capturedRemove.single, isA()); + + verify(clippingToolState.clearClipPath()).called(1); + verify(canvasStateProvider.resetCanvasWithExistingCommands()).called(1); + }); + + test('[CLIPPING_TOOL]: onCheckmark finalizes the clip area', () { + when(pathMock.actions).thenReturn([MoveToAction(0, 0), LineToAction(1, 1)]); + + clippingTool.onDown(const Offset(0, 0), paint); + clippingTool.onUp(const Offset(1, 1), paint); + + clearInteractions(commandManager); + clearInteractions(commandFactory); + clearInteractions(clippingToolState); + clearInteractions(canvasStateProvider); + + when(commandFactory.createClipAreaCommand(any, any)) + .thenAnswer((_) => MockClipAreaCommand()); + when(clippingToolState.hasActiveClipPath).thenReturn(true); + + clippingTool.onCheckmark(paint); + + final capturedRemove = + verify(commandManager.removeCommand(captureAny)).captured; + expect(capturedRemove.single, isA()); + + verify(clippingToolState.clearClipPath()).called(1); + verify(commandFactory.createClipAreaCommand(pathMock, paint)).called(1); + + final capturedAdd = + verify(commandManager.addGraphicCommand(captureAny)).captured; + expect(capturedAdd.single, isA()); + + verify(canvasStateProvider.resetCanvasWithExistingCommands()).called(1); + }); +} diff --git a/test/unit/tools/clipping_tool_test.mocks.dart b/test/unit/tools/clipping_tool_test.mocks.dart new file mode 100644 index 00000000..2ce2a684 --- /dev/null +++ b/test/unit/tools/clipping_tool_test.mocks.dart @@ -0,0 +1,1419 @@ +// Mocks generated by Mockito 5.4.5 from annotations +// in paintroid/test/unit/tools/clipping_tool_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i27; +import 'dart:ui' as _i15; + +import 'package:flutter/material.dart' as _i23; +import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i25; +import 'package:paintroid/core/commands/command_factory/command_factory.dart' + as _i21; +import 'package:paintroid/core/commands/command_implementation/command.dart' + as _i2; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_area_command.dart' + as _i13; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_path_command.dart' + as _i5; +import 'package:paintroid/core/commands/command_implementation/graphic/graphic_command.dart' + as _i19; +import 'package:paintroid/core/commands/command_implementation/graphic/line_command.dart' + as _i6; +import 'package:paintroid/core/commands/command_implementation/graphic/path_command.dart' + as _i4; +import 'package:paintroid/core/commands/command_implementation/graphic/shape/ellipse_shape_command.dart' + as _i8; +import 'package:paintroid/core/commands/command_implementation/graphic/shape/heart_shape_command.dart' + as _i11; +import 'package:paintroid/core/commands/command_implementation/graphic/shape/square_shape_command.dart' + as _i7; +import 'package:paintroid/core/commands/command_implementation/graphic/shape/star_shape_command.dart' + as _i10; +import 'package:paintroid/core/commands/command_implementation/graphic/spray_command.dart' + as _i12; +import 'package:paintroid/core/commands/command_implementation/graphic/text_command.dart' + as _i9; +import 'package:paintroid/core/commands/command_manager/command_manager.dart' + as _i18; +import 'package:paintroid/core/commands/graphic_factory/graphic_factory.dart' + as _i24; +import 'package:paintroid/core/commands/path_with_action_history.dart' as _i14; +import 'package:paintroid/core/enums/shape_style.dart' as _i22; +import 'package:paintroid/core/providers/object/tools/clipping_tool_state_provider.dart' + as _i28; +import 'package:paintroid/core/providers/state/canvas_state_data.dart' as _i17; +import 'package:paintroid/core/providers/state/canvas_state_provider.dart' + as _i26; +import 'package:paintroid/core/tools/line_tool/vertex_stack.dart' as _i20; +import 'package:paintroid/core/tools/tool_data.dart' as _i3; +import 'package:riverpod_annotation/riverpod_annotation.dart' as _i16; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeCommand_0 extends _i1.SmartFake implements _i2.Command { + _FakeCommand_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeToolData_1 extends _i1.SmartFake implements _i3.ToolData { + _FakeToolData_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePathCommand_2 extends _i1.SmartFake implements _i4.PathCommand { + _FakePathCommand_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeClipPathCommand_3 extends _i1.SmartFake + implements _i5.ClipPathCommand { + _FakeClipPathCommand_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeLineCommand_4 extends _i1.SmartFake implements _i6.LineCommand { + _FakeLineCommand_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSquareShapeCommand_5 extends _i1.SmartFake + implements _i7.SquareShapeCommand { + _FakeSquareShapeCommand_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeEllipseShapeCommand_6 extends _i1.SmartFake + implements _i8.EllipseShapeCommand { + _FakeEllipseShapeCommand_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeTextCommand_7 extends _i1.SmartFake implements _i9.TextCommand { + _FakeTextCommand_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeStarShapeCommand_8 extends _i1.SmartFake + implements _i10.StarShapeCommand { + _FakeStarShapeCommand_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeHeartShapeCommand_9 extends _i1.SmartFake + implements _i11.HeartShapeCommand { + _FakeHeartShapeCommand_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSprayCommand_10 extends _i1.SmartFake implements _i12.SprayCommand { + _FakeSprayCommand_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeClipAreaCommand_11 extends _i1.SmartFake + implements _i13.ClipAreaCommand { + _FakeClipAreaCommand_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePathWithActionHistory_12 extends _i1.SmartFake + implements _i14.PathWithActionHistory { + _FakePathWithActionHistory_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePictureRecorder_13 extends _i1.SmartFake + implements _i15.PictureRecorder { + _FakePictureRecorder_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeCanvas_14 extends _i1.SmartFake implements _i15.Canvas { + _FakeCanvas_14( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSize_15 extends _i1.SmartFake implements _i15.Size { + _FakeSize_15( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeNotifierProviderRef_16 extends _i1.SmartFake + implements _i16.NotifierProviderRef { + _FakeNotifierProviderRef_16( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeCanvasStateData_17 extends _i1.SmartFake + implements _i17.CanvasStateData { + _FakeCanvasStateData_17( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAutoDisposeNotifierProviderRef_18 extends _i1.SmartFake + implements _i16.AutoDisposeNotifierProviderRef { + _FakeAutoDisposeNotifierProviderRef_18( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePath_19 extends _i1.SmartFake implements _i15.Path { + _FakePath_19( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [CommandManager]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCommandManager extends _i1.Mock implements _i18.CommandManager { + MockCommandManager() { + _i1.throwOnMissingStub(this); + } + + @override + List<_i2.Command> get redoStack => (super.noSuchMethod( + Invocation.getter(#redoStack), + returnValue: <_i2.Command>[], + ) as List<_i2.Command>); + + @override + List<_i2.Command> get undoStack => (super.noSuchMethod( + Invocation.getter(#undoStack), + returnValue: <_i2.Command>[], + ) as List<_i2.Command>); + + @override + void addGraphicCommand(_i19.GraphicCommand? command) => super.noSuchMethod( + Invocation.method( + #addGraphicCommand, + [command], + ), + returnValueForMissingStub: null, + ); + + @override + void removeCommand(_i2.Command? commandToRemove) => super.noSuchMethod( + Invocation.method( + #removeCommand, + [commandToRemove], + ), + returnValueForMissingStub: null, + ); + + @override + void setUndoStack(List<_i2.Command>? commands) => super.noSuchMethod( + Invocation.method( + #setUndoStack, + [commands], + ), + returnValueForMissingStub: null, + ); + + @override + void executeLastCommand(_i15.Canvas? canvas) => super.noSuchMethod( + Invocation.method( + #executeLastCommand, + [canvas], + ), + returnValueForMissingStub: null, + ); + + @override + void executeAllCommands(_i15.Canvas? canvas) => super.noSuchMethod( + Invocation.method( + #executeAllCommands, + [canvas], + ), + returnValueForMissingStub: null, + ); + + @override + void discardLastCommand() => super.noSuchMethod( + Invocation.method( + #discardLastCommand, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void clearUndoStack({Iterable<_i2.Command>? newCommands}) => + super.noSuchMethod( + Invocation.method( + #clearUndoStack, + [], + {#newCommands: newCommands}, + ), + returnValueForMissingStub: null, + ); + + @override + void clearRedoStack() => super.noSuchMethod( + Invocation.method( + #clearRedoStack, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void drawLineToolGhostPaths( + _i15.Canvas? canvas, + _i6.LineCommand? ingoingGhostPathCommand, + _i6.LineCommand? outgoingGhostPathCommand, + ) => + super.noSuchMethod( + Invocation.method( + #drawLineToolGhostPaths, + [ + canvas, + ingoingGhostPathCommand, + outgoingGhostPathCommand, + ], + ), + returnValueForMissingStub: null, + ); + + @override + void drawLineToolVertices( + _i15.Canvas? canvas, + _i20.VertexStack? vertexStack, + ) => + super.noSuchMethod( + Invocation.method( + #drawLineToolVertices, + [ + canvas, + vertexStack, + ], + ), + returnValueForMissingStub: null, + ); + + @override + _i2.Command redo() => (super.noSuchMethod( + Invocation.method( + #redo, + [], + ), + returnValue: _FakeCommand_0( + this, + Invocation.method( + #redo, + [], + ), + ), + ) as _i2.Command); + + @override + void undo() => super.noSuchMethod( + Invocation.method( + #undo, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i3.ToolData getNextTool(_i18.ActionType? actionType) => (super.noSuchMethod( + Invocation.method( + #getNextTool, + [actionType], + ), + returnValue: _FakeToolData_1( + this, + Invocation.method( + #getNextTool, + [actionType], + ), + ), + ) as _i3.ToolData); + + @override + List<_i6.LineCommand> getTopLineCommandSequence() => (super.noSuchMethod( + Invocation.method( + #getTopLineCommandSequence, + [], + ), + returnValue: <_i6.LineCommand>[], + ) as List<_i6.LineCommand>); +} + +/// A class which mocks [CommandFactory]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCommandFactory extends _i1.Mock implements _i21.CommandFactory { + MockCommandFactory() { + _i1.throwOnMissingStub(this); + } + + @override + _i4.PathCommand createPathCommand( + _i14.PathWithActionHistory? path, + _i15.Paint? paint, + ) => + (super.noSuchMethod( + Invocation.method( + #createPathCommand, + [ + path, + paint, + ], + ), + returnValue: _FakePathCommand_2( + this, + Invocation.method( + #createPathCommand, + [ + path, + paint, + ], + ), + ), + ) as _i4.PathCommand); + + @override + _i5.ClipPathCommand createClipPathCommand( + _i14.PathWithActionHistory? path, + _i15.Paint? paint, { + _i15.Offset? startPoint, + _i15.Offset? endPoint, + }) => + (super.noSuchMethod( + Invocation.method( + #createClipPathCommand, + [ + path, + paint, + ], + { + #startPoint: startPoint, + #endPoint: endPoint, + }, + ), + returnValue: _FakeClipPathCommand_3( + this, + Invocation.method( + #createClipPathCommand, + [ + path, + paint, + ], + { + #startPoint: startPoint, + #endPoint: endPoint, + }, + ), + ), + ) as _i5.ClipPathCommand); + + @override + _i6.LineCommand createLineCommand( + _i14.PathWithActionHistory? path, + _i15.Paint? paint, + _i15.Offset? startPoint, + _i15.Offset? endPoint, + ) => + (super.noSuchMethod( + Invocation.method( + #createLineCommand, + [ + path, + paint, + startPoint, + endPoint, + ], + ), + returnValue: _FakeLineCommand_4( + this, + Invocation.method( + #createLineCommand, + [ + path, + paint, + startPoint, + endPoint, + ], + ), + ), + ) as _i6.LineCommand); + + @override + _i7.SquareShapeCommand createSquareShapeCommand( + _i15.Paint? paint, + _i15.Offset? topLeft, + _i15.Offset? topRight, + _i15.Offset? bottomLeft, + _i15.Offset? bottomRight, + _i22.ShapeStyle? style, + ) => + (super.noSuchMethod( + Invocation.method( + #createSquareShapeCommand, + [ + paint, + topLeft, + topRight, + bottomLeft, + bottomRight, + style, + ], + ), + returnValue: _FakeSquareShapeCommand_5( + this, + Invocation.method( + #createSquareShapeCommand, + [ + paint, + topLeft, + topRight, + bottomLeft, + bottomRight, + style, + ], + ), + ), + ) as _i7.SquareShapeCommand); + + @override + _i8.EllipseShapeCommand createEllipseShapeCommand( + _i15.Paint? paint, + double? radiusX, + double? radiusY, + _i15.Offset? center, + _i22.ShapeStyle? style, + double? angle, + ) => + (super.noSuchMethod( + Invocation.method( + #createEllipseShapeCommand, + [ + paint, + radiusX, + radiusY, + center, + style, + angle, + ], + ), + returnValue: _FakeEllipseShapeCommand_6( + this, + Invocation.method( + #createEllipseShapeCommand, + [ + paint, + radiusX, + radiusY, + center, + style, + angle, + ], + ), + ), + ) as _i8.EllipseShapeCommand); + + @override + _i9.TextCommand createTextCommand( + _i15.Offset? point, + String? text, + _i23.TextStyle? style, + double? fontSize, + _i15.Paint? paint, + double? rotationAngle, { + double? scaleX = 1.0, + double? scaleY = 1.0, + }) => + (super.noSuchMethod( + Invocation.method( + #createTextCommand, + [ + point, + text, + style, + fontSize, + paint, + rotationAngle, + ], + { + #scaleX: scaleX, + #scaleY: scaleY, + }, + ), + returnValue: _FakeTextCommand_7( + this, + Invocation.method( + #createTextCommand, + [ + point, + text, + style, + fontSize, + paint, + rotationAngle, + ], + { + #scaleX: scaleX, + #scaleY: scaleY, + }, + ), + ), + ) as _i9.TextCommand); + + @override + _i10.StarShapeCommand createStarShapeCommand( + _i15.Paint? paint, + int? numPoints, + double? angle, + _i15.Offset? center, + _i22.ShapeStyle? style, + double? radiusX, + double? radiusY, + ) => + (super.noSuchMethod( + Invocation.method( + #createStarShapeCommand, + [ + paint, + numPoints, + angle, + center, + style, + radiusX, + radiusY, + ], + ), + returnValue: _FakeStarShapeCommand_8( + this, + Invocation.method( + #createStarShapeCommand, + [ + paint, + numPoints, + angle, + center, + style, + radiusX, + radiusY, + ], + ), + ), + ) as _i10.StarShapeCommand); + + @override + _i11.HeartShapeCommand createHeartShapeCommand( + _i15.Paint? paint, + double? width, + double? height, + double? angle, + _i15.Offset? center, + _i22.ShapeStyle? style, + ) => + (super.noSuchMethod( + Invocation.method( + #createHeartShapeCommand, + [ + paint, + width, + height, + angle, + center, + style, + ], + ), + returnValue: _FakeHeartShapeCommand_9( + this, + Invocation.method( + #createHeartShapeCommand, + [ + paint, + width, + height, + angle, + center, + style, + ], + ), + ), + ) as _i11.HeartShapeCommand); + + @override + _i12.SprayCommand createSprayCommand( + List<_i15.Offset>? points, + _i15.Paint? paint, + ) => + (super.noSuchMethod( + Invocation.method( + #createSprayCommand, + [ + points, + paint, + ], + ), + returnValue: _FakeSprayCommand_10( + this, + Invocation.method( + #createSprayCommand, + [ + points, + paint, + ], + ), + ), + ) as _i12.SprayCommand); + + @override + _i13.ClipAreaCommand createClipAreaCommand( + _i14.PathWithActionHistory? path, + _i15.Paint? paint, + ) => + (super.noSuchMethod( + Invocation.method( + #createClipAreaCommand, + [ + path, + paint, + ], + ), + returnValue: _FakeClipAreaCommand_11( + this, + Invocation.method( + #createClipAreaCommand, + [ + path, + paint, + ], + ), + ), + ) as _i13.ClipAreaCommand); +} + +/// A class which mocks [GraphicFactory]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockGraphicFactory extends _i1.Mock implements _i24.GraphicFactory { + MockGraphicFactory() { + _i1.throwOnMissingStub(this); + } + + @override + _i15.Paint createPaint() => (super.noSuchMethod( + Invocation.method( + #createPaint, + [], + ), + returnValue: _i25.dummyValue<_i15.Paint>( + this, + Invocation.method( + #createPaint, + [], + ), + ), + ) as _i15.Paint); + + @override + _i14.PathWithActionHistory createPathWithActionHistory() => + (super.noSuchMethod( + Invocation.method( + #createPathWithActionHistory, + [], + ), + returnValue: _FakePathWithActionHistory_12( + this, + Invocation.method( + #createPathWithActionHistory, + [], + ), + ), + ) as _i14.PathWithActionHistory); + + @override + _i15.PictureRecorder createPictureRecorder() => (super.noSuchMethod( + Invocation.method( + #createPictureRecorder, + [], + ), + returnValue: _FakePictureRecorder_13( + this, + Invocation.method( + #createPictureRecorder, + [], + ), + ), + ) as _i15.PictureRecorder); + + @override + _i15.Canvas createCanvasWithRecorder(_i15.PictureRecorder? recorder) => + (super.noSuchMethod( + Invocation.method( + #createCanvasWithRecorder, + [recorder], + ), + returnValue: _FakeCanvas_14( + this, + Invocation.method( + #createCanvasWithRecorder, + [recorder], + ), + ), + ) as _i15.Canvas); + + @override + _i15.Paint createWatercolorPaint( + _i15.Paint? originalPaint, + double? blurSigma, + ) => + (super.noSuchMethod( + Invocation.method( + #createWatercolorPaint, + [ + originalPaint, + blurSigma, + ], + ), + returnValue: _i25.dummyValue<_i15.Paint>( + this, + Invocation.method( + #createWatercolorPaint, + [ + originalPaint, + blurSigma, + ], + ), + ), + ) as _i15.Paint); + + @override + _i15.Paint copyPaint(_i15.Paint? original) => (super.noSuchMethod( + Invocation.method( + #copyPaint, + [original], + ), + returnValue: _i25.dummyValue<_i15.Paint>( + this, + Invocation.method( + #copyPaint, + [original], + ), + ), + ) as _i15.Paint); +} + +/// A class which mocks [GraphicCommand]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockGraphicCommand extends _i1.Mock implements _i19.GraphicCommand { + MockGraphicCommand() { + _i1.throwOnMissingStub(this); + } + + @override + _i15.Paint get paint => (super.noSuchMethod( + Invocation.getter(#paint), + returnValue: _i25.dummyValue<_i15.Paint>( + this, + Invocation.getter(#paint), + ), + ) as _i15.Paint); + + @override + List get props => (super.noSuchMethod( + Invocation.getter(#props), + returnValue: [], + ) as List); + + @override + void call(_i15.Canvas? canvas) => super.noSuchMethod( + Invocation.method( + #call, + [canvas], + ), + returnValueForMissingStub: null, + ); + + @override + Map toJson() => (super.noSuchMethod( + Invocation.method( + #toJson, + [], + ), + returnValue: {}, + ) as Map); +} + +/// A class which mocks [CanvasStateProvider]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCanvasStateProvider extends _i1.Mock + implements _i26.CanvasStateProvider { + MockCanvasStateProvider() { + _i1.throwOnMissingStub(this); + } + + @override + _i15.Size get initialCanvasSize => (super.noSuchMethod( + Invocation.getter(#initialCanvasSize), + returnValue: _FakeSize_15( + this, + Invocation.getter(#initialCanvasSize), + ), + ) as _i15.Size); + + @override + set initialCanvasSize(_i15.Size? _initialCanvasSize) => super.noSuchMethod( + Invocation.setter( + #initialCanvasSize, + _initialCanvasSize, + ), + returnValueForMissingStub: null, + ); + + @override + _i16.NotifierProviderRef<_i17.CanvasStateData> get ref => (super.noSuchMethod( + Invocation.getter(#ref), + returnValue: _FakeNotifierProviderRef_16<_i17.CanvasStateData>( + this, + Invocation.getter(#ref), + ), + ) as _i16.NotifierProviderRef<_i17.CanvasStateData>); + + @override + _i17.CanvasStateData get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: _FakeCanvasStateData_17( + this, + Invocation.getter(#state), + ), + ) as _i17.CanvasStateData); + + @override + set state(_i17.CanvasStateData? value) => super.noSuchMethod( + Invocation.setter( + #state, + value, + ), + returnValueForMissingStub: null, + ); + + @override + _i17.CanvasStateData build() => (super.noSuchMethod( + Invocation.method( + #build, + [], + ), + returnValue: _FakeCanvasStateData_17( + this, + Invocation.method( + #build, + [], + ), + ), + ) as _i17.CanvasStateData); + + @override + void setBackgroundImage(_i15.Image? image) => super.noSuchMethod( + Invocation.method( + #setBackgroundImage, + [image], + ), + returnValueForMissingStub: null, + ); + + @override + void clearBackgroundImageAndResetDimensions() => super.noSuchMethod( + Invocation.method( + #clearBackgroundImageAndResetDimensions, + [], + ), + returnValueForMissingStub: null, + ); + + @override + _i27.Future updateCachedImage() => (super.noSuchMethod( + Invocation.method( + #updateCachedImage, + [], + ), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), + ) as _i27.Future); + + @override + _i27.Future resetCanvasWithNewCommands( + Iterable<_i2.Command>? commands) => + (super.noSuchMethod( + Invocation.method( + #resetCanvasWithNewCommands, + [commands], + ), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), + ) as _i27.Future); + + @override + _i27.Future resetCanvasWithExistingCommands() => (super.noSuchMethod( + Invocation.method( + #resetCanvasWithExistingCommands, + [], + ), + returnValue: _i27.Future.value(), + returnValueForMissingStub: _i27.Future.value(), + ) as _i27.Future); + + @override + void listenSelf( + void Function( + _i17.CanvasStateData?, + _i17.CanvasStateData, + )? listener, { + void Function( + Object, + StackTrace, + )? onError, + }) => + super.noSuchMethod( + Invocation.method( + #listenSelf, + [listener], + {#onError: onError}, + ), + returnValueForMissingStub: null, + ); + + @override + bool updateShouldNotify( + _i17.CanvasStateData? previous, + _i17.CanvasStateData? next, + ) => + (super.noSuchMethod( + Invocation.method( + #updateShouldNotify, + [ + previous, + next, + ], + ), + returnValue: false, + ) as bool); +} + +/// A class which mocks [ClippingToolState]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockClippingToolState extends _i1.Mock implements _i28.ClippingToolState { + MockClippingToolState() { + _i1.throwOnMissingStub(this); + } + + @override + bool get hasActiveClipPath => (super.noSuchMethod( + Invocation.getter(#hasActiveClipPath), + returnValue: false, + ) as bool); + + @override + _i16.AutoDisposeNotifierProviderRef get ref => (super.noSuchMethod( + Invocation.getter(#ref), + returnValue: _FakeAutoDisposeNotifierProviderRef_18( + this, + Invocation.getter(#ref), + ), + ) as _i16.AutoDisposeNotifierProviderRef); + + @override + bool get state => (super.noSuchMethod( + Invocation.getter(#state), + returnValue: false, + ) as bool); + + @override + set state(bool? value) => super.noSuchMethod( + Invocation.setter( + #state, + value, + ), + returnValueForMissingStub: null, + ); + + @override + bool build() => (super.noSuchMethod( + Invocation.method( + #build, + [], + ), + returnValue: false, + ) as bool); + + @override + void setHasActiveClipPath(bool? hasActive) => super.noSuchMethod( + Invocation.method( + #setHasActiveClipPath, + [hasActive], + ), + returnValueForMissingStub: null, + ); + + @override + void clearClipPath() => super.noSuchMethod( + Invocation.method( + #clearClipPath, + [], + ), + returnValueForMissingStub: null, + ); + + @override + void listenSelf( + void Function( + bool?, + bool, + )? listener, { + void Function( + Object, + StackTrace, + )? onError, + }) => + super.noSuchMethod( + Invocation.method( + #listenSelf, + [listener], + {#onError: onError}, + ), + returnValueForMissingStub: null, + ); + + @override + bool updateShouldNotify( + bool? previous, + bool? next, + ) => + (super.noSuchMethod( + Invocation.method( + #updateShouldNotify, + [ + previous, + next, + ], + ), + returnValue: false, + ) as bool); +} + +/// A class which mocks [PathWithActionHistory]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockPathWithActionHistory extends _i1.Mock + implements _i14.PathWithActionHistory { + MockPathWithActionHistory() { + _i1.throwOnMissingStub(this); + } + + @override + _i15.Path get path => (super.noSuchMethod( + Invocation.getter(#path), + returnValue: _FakePath_19( + this, + Invocation.getter(#path), + ), + ) as _i15.Path); + + @override + List<_i14.PathAction> get actions => (super.noSuchMethod( + Invocation.getter(#actions), + returnValue: <_i14.PathAction>[], + ) as List<_i14.PathAction>); + + @override + void moveTo( + double? x, + double? y, + ) => + super.noSuchMethod( + Invocation.method( + #moveTo, + [ + x, + y, + ], + ), + returnValueForMissingStub: null, + ); + + @override + void lineTo( + double? x, + double? y, + ) => + super.noSuchMethod( + Invocation.method( + #lineTo, + [ + x, + y, + ], + ), + returnValueForMissingStub: null, + ); + + @override + void close() => super.noSuchMethod( + Invocation.method( + #close, + [], + ), + returnValueForMissingStub: null, + ); + + @override + Map toJson() => (super.noSuchMethod( + Invocation.method( + #toJson, + [], + ), + returnValue: {}, + ) as Map); +} + +/// A class which mocks [ClipPathCommand]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockClipPathCommand extends _i1.Mock implements _i5.ClipPathCommand { + MockClipPathCommand() { + _i1.throwOnMissingStub(this); + } + + @override + String get type => (super.noSuchMethod( + Invocation.getter(#type), + returnValue: _i25.dummyValue( + this, + Invocation.getter(#type), + ), + ) as String); + + @override + int get version => (super.noSuchMethod( + Invocation.getter(#version), + returnValue: 0, + ) as int); + + @override + _i14.PathWithActionHistory get path => (super.noSuchMethod( + Invocation.getter(#path), + returnValue: _FakePathWithActionHistory_12( + this, + Invocation.getter(#path), + ), + ) as _i14.PathWithActionHistory); + + @override + List get props => (super.noSuchMethod( + Invocation.getter(#props), + returnValue: [], + ) as List); + + @override + _i15.Paint get paint => (super.noSuchMethod( + Invocation.getter(#paint), + returnValue: _i25.dummyValue<_i15.Paint>( + this, + Invocation.getter(#paint), + ), + ) as _i15.Paint); + + @override + void call(_i15.Canvas? canvas) => super.noSuchMethod( + Invocation.method( + #call, + [canvas], + ), + returnValueForMissingStub: null, + ); + + @override + Map toJson() => (super.noSuchMethod( + Invocation.method( + #toJson, + [], + ), + returnValue: {}, + ) as Map); +} + +/// A class which mocks [ClipAreaCommand]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockClipAreaCommand extends _i1.Mock implements _i13.ClipAreaCommand { + MockClipAreaCommand() { + _i1.throwOnMissingStub(this); + } + + @override + String get type => (super.noSuchMethod( + Invocation.getter(#type), + returnValue: _i25.dummyValue( + this, + Invocation.getter(#type), + ), + ) as String); + + @override + int get version => (super.noSuchMethod( + Invocation.getter(#version), + returnValue: 0, + ) as int); + + @override + _i14.PathWithActionHistory get clipPathData => (super.noSuchMethod( + Invocation.getter(#clipPathData), + returnValue: _FakePathWithActionHistory_12( + this, + Invocation.getter(#clipPathData), + ), + ) as _i14.PathWithActionHistory); + + @override + List get props => (super.noSuchMethod( + Invocation.getter(#props), + returnValue: [], + ) as List); + + @override + _i15.Paint get paint => (super.noSuchMethod( + Invocation.getter(#paint), + returnValue: _i25.dummyValue<_i15.Paint>( + this, + Invocation.getter(#paint), + ), + ) as _i15.Paint); + + @override + void call(_i15.Canvas? canvas) => super.noSuchMethod( + Invocation.method( + #call, + [canvas], + ), + returnValueForMissingStub: null, + ); + + @override + Map toJson() => (super.noSuchMethod( + Invocation.method( + #toJson, + [], + ), + returnValue: {}, + ) as Map); +} diff --git a/test/unit/tools/text_tool_test.mocks.dart b/test/unit/tools/text_tool_test.mocks.dart index aec80aba..c7b5aa02 100644 --- a/test/unit/tools/text_tool_test.mocks.dart +++ b/test/unit/tools/text_tool_test.mocks.dart @@ -3,46 +3,50 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:typed_data' as _i22; -import 'dart:ui' as _i13; +import 'dart:typed_data' as _i24; +import 'dart:ui' as _i15; -import 'package:flutter/material.dart' as _i14; +import 'package:flutter/material.dart' as _i16; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i21; +import 'package:mockito/src/dummies.dart' as _i23; import 'package:paintroid/core/commands/command_factory/command_factory.dart' - as _i19; + as _i21; import 'package:paintroid/core/commands/command_implementation/command.dart' as _i2; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_area_command.dart' + as _i13; +import 'package:paintroid/core/commands/command_implementation/graphic/clip_path_command.dart' + as _i5; import 'package:paintroid/core/commands/command_implementation/graphic/graphic_command.dart' - as _i17; + as _i19; import 'package:paintroid/core/commands/command_implementation/graphic/line_command.dart' - as _i5; + as _i6; import 'package:paintroid/core/commands/command_implementation/graphic/path_command.dart' as _i4; import 'package:paintroid/core/commands/command_implementation/graphic/shape/ellipse_shape_command.dart' - as _i7; + as _i8; import 'package:paintroid/core/commands/command_implementation/graphic/shape/heart_shape_command.dart' - as _i10; + as _i11; import 'package:paintroid/core/commands/command_implementation/graphic/shape/square_shape_command.dart' - as _i6; + as _i7; import 'package:paintroid/core/commands/command_implementation/graphic/shape/star_shape_command.dart' - as _i9; + as _i10; import 'package:paintroid/core/commands/command_implementation/graphic/spray_command.dart' - as _i11; + as _i12; import 'package:paintroid/core/commands/command_implementation/graphic/text_command.dart' - as _i8; + as _i9; import 'package:paintroid/core/commands/command_manager/command_manager.dart' - as _i16; + as _i18; import 'package:paintroid/core/commands/graphic_factory/graphic_factory.dart' - as _i23; -import 'package:paintroid/core/commands/path_with_action_history.dart' as _i15; -import 'package:paintroid/core/enums/bounding_box_action.dart' as _i25; -import 'package:paintroid/core/enums/bounding_box_resize_action.dart' as _i26; -import 'package:paintroid/core/enums/shape_style.dart' as _i20; -import 'package:paintroid/core/tools/bounding_box.dart' as _i24; -import 'package:paintroid/core/tools/line_tool/vertex_stack.dart' as _i18; + as _i25; +import 'package:paintroid/core/commands/path_with_action_history.dart' as _i17; +import 'package:paintroid/core/enums/bounding_box_action.dart' as _i27; +import 'package:paintroid/core/enums/bounding_box_resize_action.dart' as _i28; +import 'package:paintroid/core/enums/shape_style.dart' as _i22; +import 'package:paintroid/core/tools/bounding_box.dart' as _i26; +import 'package:paintroid/core/tools/line_tool/vertex_stack.dart' as _i20; import 'package:paintroid/core/tools/tool_data.dart' as _i3; -import 'package:riverpod/src/internals.dart' as _i12; +import 'package:riverpod/src/internals.dart' as _i14; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -88,8 +92,9 @@ class _FakePathCommand_2 extends _i1.SmartFake implements _i4.PathCommand { ); } -class _FakeLineCommand_3 extends _i1.SmartFake implements _i5.LineCommand { - _FakeLineCommand_3( +class _FakeClipPathCommand_3 extends _i1.SmartFake + implements _i5.ClipPathCommand { + _FakeClipPathCommand_3( Object parent, Invocation parentInvocation, ) : super( @@ -98,9 +103,8 @@ class _FakeLineCommand_3 extends _i1.SmartFake implements _i5.LineCommand { ); } -class _FakeSquareShapeCommand_4 extends _i1.SmartFake - implements _i6.SquareShapeCommand { - _FakeSquareShapeCommand_4( +class _FakeLineCommand_4 extends _i1.SmartFake implements _i6.LineCommand { + _FakeLineCommand_4( Object parent, Invocation parentInvocation, ) : super( @@ -109,9 +113,9 @@ class _FakeSquareShapeCommand_4 extends _i1.SmartFake ); } -class _FakeEllipseShapeCommand_5 extends _i1.SmartFake - implements _i7.EllipseShapeCommand { - _FakeEllipseShapeCommand_5( +class _FakeSquareShapeCommand_5 extends _i1.SmartFake + implements _i7.SquareShapeCommand { + _FakeSquareShapeCommand_5( Object parent, Invocation parentInvocation, ) : super( @@ -120,8 +124,9 @@ class _FakeEllipseShapeCommand_5 extends _i1.SmartFake ); } -class _FakeTextCommand_6 extends _i1.SmartFake implements _i8.TextCommand { - _FakeTextCommand_6( +class _FakeEllipseShapeCommand_6 extends _i1.SmartFake + implements _i8.EllipseShapeCommand { + _FakeEllipseShapeCommand_6( Object parent, Invocation parentInvocation, ) : super( @@ -130,9 +135,8 @@ class _FakeTextCommand_6 extends _i1.SmartFake implements _i8.TextCommand { ); } -class _FakeStarShapeCommand_7 extends _i1.SmartFake - implements _i9.StarShapeCommand { - _FakeStarShapeCommand_7( +class _FakeTextCommand_7 extends _i1.SmartFake implements _i9.TextCommand { + _FakeTextCommand_7( Object parent, Invocation parentInvocation, ) : super( @@ -141,9 +145,9 @@ class _FakeStarShapeCommand_7 extends _i1.SmartFake ); } -class _FakeHeartShapeCommand_8 extends _i1.SmartFake - implements _i10.HeartShapeCommand { - _FakeHeartShapeCommand_8( +class _FakeStarShapeCommand_8 extends _i1.SmartFake + implements _i10.StarShapeCommand { + _FakeStarShapeCommand_8( Object parent, Invocation parentInvocation, ) : super( @@ -152,8 +156,9 @@ class _FakeHeartShapeCommand_8 extends _i1.SmartFake ); } -class _FakeSprayCommand_9 extends _i1.SmartFake implements _i11.SprayCommand { - _FakeSprayCommand_9( +class _FakeHeartShapeCommand_9 extends _i1.SmartFake + implements _i11.HeartShapeCommand { + _FakeHeartShapeCommand_9( Object parent, Invocation parentInvocation, ) : super( @@ -162,9 +167,8 @@ class _FakeSprayCommand_9 extends _i1.SmartFake implements _i11.SprayCommand { ); } -class _FakeProviderContainer_10 extends _i1.SmartFake - implements _i12.ProviderContainer { - _FakeProviderContainer_10( +class _FakeSprayCommand_10 extends _i1.SmartFake implements _i12.SprayCommand { + _FakeSprayCommand_10( Object parent, Invocation parentInvocation, ) : super( @@ -173,9 +177,9 @@ class _FakeProviderContainer_10 extends _i1.SmartFake ); } -class _FakeKeepAliveLink_11 extends _i1.SmartFake - implements _i12.KeepAliveLink { - _FakeKeepAliveLink_11( +class _FakeClipAreaCommand_11 extends _i1.SmartFake + implements _i13.ClipAreaCommand { + _FakeClipAreaCommand_11( Object parent, Invocation parentInvocation, ) : super( @@ -184,9 +188,9 @@ class _FakeKeepAliveLink_11 extends _i1.SmartFake ); } -class _FakeProviderSubscription_12 extends _i1.SmartFake - implements _i12.ProviderSubscription { - _FakeProviderSubscription_12( +class _FakeProviderContainer_12 extends _i1.SmartFake + implements _i14.ProviderContainer { + _FakeProviderContainer_12( Object parent, Invocation parentInvocation, ) : super( @@ -195,8 +199,9 @@ class _FakeProviderSubscription_12 extends _i1.SmartFake ); } -class _FakeRect_13 extends _i1.SmartFake implements _i13.Rect { - _FakeRect_13( +class _FakeKeepAliveLink_13 extends _i1.SmartFake + implements _i14.KeepAliveLink { + _FakeKeepAliveLink_13( Object parent, Invocation parentInvocation, ) : super( @@ -205,8 +210,9 @@ class _FakeRect_13 extends _i1.SmartFake implements _i13.Rect { ); } -class _FakeOffset_14 extends _i1.SmartFake implements _i13.Offset { - _FakeOffset_14( +class _FakeProviderSubscription_14 extends _i1.SmartFake + implements _i14.ProviderSubscription { + _FakeProviderSubscription_14( Object parent, Invocation parentInvocation, ) : super( @@ -215,8 +221,28 @@ class _FakeOffset_14 extends _i1.SmartFake implements _i13.Offset { ); } -class _FakeTextStyle_15 extends _i1.SmartFake implements _i14.TextStyle { - _FakeTextStyle_15( +class _FakeRect_15 extends _i1.SmartFake implements _i15.Rect { + _FakeRect_15( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeOffset_16 extends _i1.SmartFake implements _i15.Offset { + _FakeOffset_16( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeTextStyle_17 extends _i1.SmartFake implements _i16.TextStyle { + _FakeTextStyle_17( Object parent, Invocation parentInvocation, ) : super( @@ -226,13 +252,13 @@ class _FakeTextStyle_15 extends _i1.SmartFake implements _i14.TextStyle { @override String toString( - {_i14.DiagnosticLevel? minLevel = _i14.DiagnosticLevel.info}) => + {_i16.DiagnosticLevel? minLevel = _i16.DiagnosticLevel.info}) => super.toString(); } -class _FakePathWithActionHistory_16 extends _i1.SmartFake - implements _i15.PathWithActionHistory { - _FakePathWithActionHistory_16( +class _FakePathWithActionHistory_18 extends _i1.SmartFake + implements _i17.PathWithActionHistory { + _FakePathWithActionHistory_18( Object parent, Invocation parentInvocation, ) : super( @@ -241,9 +267,9 @@ class _FakePathWithActionHistory_16 extends _i1.SmartFake ); } -class _FakePictureRecorder_17 extends _i1.SmartFake - implements _i13.PictureRecorder { - _FakePictureRecorder_17( +class _FakePictureRecorder_19 extends _i1.SmartFake + implements _i15.PictureRecorder { + _FakePictureRecorder_19( Object parent, Invocation parentInvocation, ) : super( @@ -252,8 +278,8 @@ class _FakePictureRecorder_17 extends _i1.SmartFake ); } -class _FakeCanvas_18 extends _i1.SmartFake implements _i13.Canvas { - _FakeCanvas_18( +class _FakeCanvas_20 extends _i1.SmartFake implements _i15.Canvas { + _FakeCanvas_20( Object parent, Invocation parentInvocation, ) : super( @@ -265,7 +291,7 @@ class _FakeCanvas_18 extends _i1.SmartFake implements _i13.Canvas { /// A class which mocks [CommandManager]. /// /// See the documentation for Mockito's code generation for more information. -class MockCommandManager extends _i1.Mock implements _i16.CommandManager { +class MockCommandManager extends _i1.Mock implements _i18.CommandManager { MockCommandManager() { _i1.throwOnMissingStub(this); } @@ -283,7 +309,7 @@ class MockCommandManager extends _i1.Mock implements _i16.CommandManager { ) as List<_i2.Command>); @override - void addGraphicCommand(_i17.GraphicCommand? command) => super.noSuchMethod( + void addGraphicCommand(_i19.GraphicCommand? command) => super.noSuchMethod( Invocation.method( #addGraphicCommand, [command], @@ -291,6 +317,15 @@ class MockCommandManager extends _i1.Mock implements _i16.CommandManager { returnValueForMissingStub: null, ); + @override + void removeCommand(_i2.Command? commandToRemove) => super.noSuchMethod( + Invocation.method( + #removeCommand, + [commandToRemove], + ), + returnValueForMissingStub: null, + ); + @override void setUndoStack(List<_i2.Command>? commands) => super.noSuchMethod( Invocation.method( @@ -301,7 +336,7 @@ class MockCommandManager extends _i1.Mock implements _i16.CommandManager { ); @override - void executeLastCommand(_i13.Canvas? canvas) => super.noSuchMethod( + void executeLastCommand(_i15.Canvas? canvas) => super.noSuchMethod( Invocation.method( #executeLastCommand, [canvas], @@ -310,7 +345,7 @@ class MockCommandManager extends _i1.Mock implements _i16.CommandManager { ); @override - void executeAllCommands(_i13.Canvas? canvas) => super.noSuchMethod( + void executeAllCommands(_i15.Canvas? canvas) => super.noSuchMethod( Invocation.method( #executeAllCommands, [canvas], @@ -349,9 +384,9 @@ class MockCommandManager extends _i1.Mock implements _i16.CommandManager { @override void drawLineToolGhostPaths( - _i13.Canvas? canvas, - _i5.LineCommand? ingoingGhostPathCommand, - _i5.LineCommand? outgoingGhostPathCommand, + _i15.Canvas? canvas, + _i6.LineCommand? ingoingGhostPathCommand, + _i6.LineCommand? outgoingGhostPathCommand, ) => super.noSuchMethod( Invocation.method( @@ -367,8 +402,8 @@ class MockCommandManager extends _i1.Mock implements _i16.CommandManager { @override void drawLineToolVertices( - _i13.Canvas? canvas, - _i18.VertexStack? vertexStack, + _i15.Canvas? canvas, + _i20.VertexStack? vertexStack, ) => super.noSuchMethod( Invocation.method( @@ -406,7 +441,7 @@ class MockCommandManager extends _i1.Mock implements _i16.CommandManager { ); @override - _i3.ToolData getNextTool(_i16.ActionType? actionType) => (super.noSuchMethod( + _i3.ToolData getNextTool(_i18.ActionType? actionType) => (super.noSuchMethod( Invocation.method( #getNextTool, [actionType], @@ -421,27 +456,27 @@ class MockCommandManager extends _i1.Mock implements _i16.CommandManager { ) as _i3.ToolData); @override - List<_i5.LineCommand> getTopLineCommandSequence() => (super.noSuchMethod( + List<_i6.LineCommand> getTopLineCommandSequence() => (super.noSuchMethod( Invocation.method( #getTopLineCommandSequence, [], ), - returnValue: <_i5.LineCommand>[], - ) as List<_i5.LineCommand>); + returnValue: <_i6.LineCommand>[], + ) as List<_i6.LineCommand>); } /// A class which mocks [CommandFactory]. /// /// See the documentation for Mockito's code generation for more information. -class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { +class MockCommandFactory extends _i1.Mock implements _i21.CommandFactory { MockCommandFactory() { _i1.throwOnMissingStub(this); } @override _i4.PathCommand createPathCommand( - _i15.PathWithActionHistory? path, - _i13.Paint? paint, + _i17.PathWithActionHistory? path, + _i15.Paint? paint, ) => (super.noSuchMethod( Invocation.method( @@ -464,11 +499,46 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { ) as _i4.PathCommand); @override - _i5.LineCommand createLineCommand( - _i15.PathWithActionHistory? path, - _i13.Paint? paint, - _i13.Offset? startPoint, - _i13.Offset? endPoint, + _i5.ClipPathCommand createClipPathCommand( + _i17.PathWithActionHistory? path, + _i15.Paint? paint, { + _i15.Offset? startPoint, + _i15.Offset? endPoint, + }) => + (super.noSuchMethod( + Invocation.method( + #createClipPathCommand, + [ + path, + paint, + ], + { + #startPoint: startPoint, + #endPoint: endPoint, + }, + ), + returnValue: _FakeClipPathCommand_3( + this, + Invocation.method( + #createClipPathCommand, + [ + path, + paint, + ], + { + #startPoint: startPoint, + #endPoint: endPoint, + }, + ), + ), + ) as _i5.ClipPathCommand); + + @override + _i6.LineCommand createLineCommand( + _i17.PathWithActionHistory? path, + _i15.Paint? paint, + _i15.Offset? startPoint, + _i15.Offset? endPoint, ) => (super.noSuchMethod( Invocation.method( @@ -480,7 +550,7 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { endPoint, ], ), - returnValue: _FakeLineCommand_3( + returnValue: _FakeLineCommand_4( this, Invocation.method( #createLineCommand, @@ -492,16 +562,16 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { ], ), ), - ) as _i5.LineCommand); + ) as _i6.LineCommand); @override - _i6.SquareShapeCommand createSquareShapeCommand( - _i13.Paint? paint, - _i13.Offset? topLeft, - _i13.Offset? topRight, - _i13.Offset? bottomLeft, - _i13.Offset? bottomRight, - _i20.ShapeStyle? style, + _i7.SquareShapeCommand createSquareShapeCommand( + _i15.Paint? paint, + _i15.Offset? topLeft, + _i15.Offset? topRight, + _i15.Offset? bottomLeft, + _i15.Offset? bottomRight, + _i22.ShapeStyle? style, ) => (super.noSuchMethod( Invocation.method( @@ -515,7 +585,7 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { style, ], ), - returnValue: _FakeSquareShapeCommand_4( + returnValue: _FakeSquareShapeCommand_5( this, Invocation.method( #createSquareShapeCommand, @@ -529,15 +599,15 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { ], ), ), - ) as _i6.SquareShapeCommand); + ) as _i7.SquareShapeCommand); @override - _i7.EllipseShapeCommand createEllipseShapeCommand( - _i13.Paint? paint, + _i8.EllipseShapeCommand createEllipseShapeCommand( + _i15.Paint? paint, double? radiusX, double? radiusY, - _i13.Offset? center, - _i20.ShapeStyle? style, + _i15.Offset? center, + _i22.ShapeStyle? style, double? angle, ) => (super.noSuchMethod( @@ -552,7 +622,7 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { angle, ], ), - returnValue: _FakeEllipseShapeCommand_5( + returnValue: _FakeEllipseShapeCommand_6( this, Invocation.method( #createEllipseShapeCommand, @@ -566,15 +636,15 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { ], ), ), - ) as _i7.EllipseShapeCommand); + ) as _i8.EllipseShapeCommand); @override - _i8.TextCommand createTextCommand( - _i13.Offset? point, + _i9.TextCommand createTextCommand( + _i15.Offset? point, String? text, - _i14.TextStyle? style, + _i16.TextStyle? style, double? fontSize, - _i13.Paint? paint, + _i15.Paint? paint, double? rotationAngle, { double? scaleX = 1.0, double? scaleY = 1.0, @@ -595,7 +665,7 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { #scaleY: scaleY, }, ), - returnValue: _FakeTextCommand_6( + returnValue: _FakeTextCommand_7( this, Invocation.method( #createTextCommand, @@ -613,15 +683,15 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { }, ), ), - ) as _i8.TextCommand); + ) as _i9.TextCommand); @override - _i9.StarShapeCommand createStarShapeCommand( - _i13.Paint? paint, + _i10.StarShapeCommand createStarShapeCommand( + _i15.Paint? paint, int? numPoints, double? angle, - _i13.Offset? center, - _i20.ShapeStyle? style, + _i15.Offset? center, + _i22.ShapeStyle? style, double? radiusX, double? radiusY, ) => @@ -638,7 +708,7 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { radiusY, ], ), - returnValue: _FakeStarShapeCommand_7( + returnValue: _FakeStarShapeCommand_8( this, Invocation.method( #createStarShapeCommand, @@ -653,16 +723,16 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { ], ), ), - ) as _i9.StarShapeCommand); + ) as _i10.StarShapeCommand); @override - _i10.HeartShapeCommand createHeartShapeCommand( - _i13.Paint? paint, + _i11.HeartShapeCommand createHeartShapeCommand( + _i15.Paint? paint, double? width, double? height, double? angle, - _i13.Offset? center, - _i20.ShapeStyle? style, + _i15.Offset? center, + _i22.ShapeStyle? style, ) => (super.noSuchMethod( Invocation.method( @@ -676,7 +746,7 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { style, ], ), - returnValue: _FakeHeartShapeCommand_8( + returnValue: _FakeHeartShapeCommand_9( this, Invocation.method( #createHeartShapeCommand, @@ -690,12 +760,12 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { ], ), ), - ) as _i10.HeartShapeCommand); + ) as _i11.HeartShapeCommand); @override - _i11.SprayCommand createSprayCommand( - List<_i13.Offset>? points, - _i13.Paint? paint, + _i12.SprayCommand createSprayCommand( + List<_i15.Offset>? points, + _i15.Paint? paint, ) => (super.noSuchMethod( Invocation.method( @@ -705,7 +775,7 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { paint, ], ), - returnValue: _FakeSprayCommand_9( + returnValue: _FakeSprayCommand_10( this, Invocation.method( #createSprayCommand, @@ -715,34 +785,59 @@ class MockCommandFactory extends _i1.Mock implements _i19.CommandFactory { ], ), ), - ) as _i11.SprayCommand); + ) as _i12.SprayCommand); + + @override + _i13.ClipAreaCommand createClipAreaCommand( + _i17.PathWithActionHistory? path, + _i15.Paint? paint, + ) => + (super.noSuchMethod( + Invocation.method( + #createClipAreaCommand, + [ + path, + paint, + ], + ), + returnValue: _FakeClipAreaCommand_11( + this, + Invocation.method( + #createClipAreaCommand, + [ + path, + paint, + ], + ), + ), + ) as _i13.ClipAreaCommand); } /// A class which mocks [Ref]. /// /// See the documentation for Mockito's code generation for more information. class MockRef extends _i1.Mock - implements _i12.Ref { + implements _i14.Ref { MockRef() { _i1.throwOnMissingStub(this); } @override - _i12.ProviderContainer get container => (super.noSuchMethod( + _i14.ProviderContainer get container => (super.noSuchMethod( Invocation.getter(#container), - returnValue: _FakeProviderContainer_10( + returnValue: _FakeProviderContainer_12( this, Invocation.getter(#container), ), - ) as _i12.ProviderContainer); + ) as _i14.ProviderContainer); @override - T refresh(_i12.Refreshable? provider) => (super.noSuchMethod( + T refresh(_i14.Refreshable? provider) => (super.noSuchMethod( Invocation.method( #refresh, [provider], ), - returnValue: _i21.dummyValue( + returnValue: _i23.dummyValue( this, Invocation.method( #refresh, @@ -752,7 +847,7 @@ class MockRef extends _i1.Mock ) as T); @override - void invalidate(_i12.ProviderOrFamily? provider) => super.noSuchMethod( + void invalidate(_i14.ProviderOrFamily? provider) => super.noSuchMethod( Invocation.method( #invalidate, [provider], @@ -844,12 +939,12 @@ class MockRef extends _i1.Mock ); @override - T read(_i12.ProviderListenable? provider) => (super.noSuchMethod( + T read(_i14.ProviderListenable? provider) => (super.noSuchMethod( Invocation.method( #read, [provider], ), - returnValue: _i21.dummyValue( + returnValue: _i23.dummyValue( this, Invocation.method( #read, @@ -859,7 +954,7 @@ class MockRef extends _i1.Mock ) as T); @override - bool exists(_i12.ProviderBase? provider) => (super.noSuchMethod( + bool exists(_i14.ProviderBase? provider) => (super.noSuchMethod( Invocation.method( #exists, [provider], @@ -868,12 +963,12 @@ class MockRef extends _i1.Mock ) as bool); @override - T watch(_i12.ProviderListenable? provider) => (super.noSuchMethod( + T watch(_i14.ProviderListenable? provider) => (super.noSuchMethod( Invocation.method( #watch, [provider], ), - returnValue: _i21.dummyValue( + returnValue: _i23.dummyValue( this, Invocation.method( #watch, @@ -883,23 +978,23 @@ class MockRef extends _i1.Mock ) as T); @override - _i12.KeepAliveLink keepAlive() => (super.noSuchMethod( + _i14.KeepAliveLink keepAlive() => (super.noSuchMethod( Invocation.method( #keepAlive, [], ), - returnValue: _FakeKeepAliveLink_11( + returnValue: _FakeKeepAliveLink_13( this, Invocation.method( #keepAlive, [], ), ), - ) as _i12.KeepAliveLink); + ) as _i14.KeepAliveLink); @override - _i12.ProviderSubscription listen( - _i12.ProviderListenable? provider, + _i14.ProviderSubscription listen( + _i14.ProviderListenable? provider, void Function( T?, T, @@ -922,7 +1017,7 @@ class MockRef extends _i1.Mock #fireImmediately: fireImmediately, }, ), - returnValue: _FakeProviderSubscription_12( + returnValue: _FakeProviderSubscription_14( this, Invocation.method( #listen, @@ -936,13 +1031,13 @@ class MockRef extends _i1.Mock }, ), ), - ) as _i12.ProviderSubscription); + ) as _i14.ProviderSubscription); } /// A class which mocks [Canvas]. /// /// See the documentation for Mockito's code generation for more information. -class MockCanvas extends _i1.Mock implements _i13.Canvas { +class MockCanvas extends _i1.Mock implements _i15.Canvas { MockCanvas() { _i1.throwOnMissingStub(this); } @@ -958,8 +1053,8 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void saveLayer( - _i13.Rect? bounds, - _i13.Paint? paint, + _i15.Rect? bounds, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1057,7 +1152,7 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { ); @override - void transform(_i22.Float64List? matrix4) => super.noSuchMethod( + void transform(_i24.Float64List? matrix4) => super.noSuchMethod( Invocation.method( #transform, [matrix4], @@ -1066,18 +1161,18 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { ); @override - _i22.Float64List getTransform() => (super.noSuchMethod( + _i24.Float64List getTransform() => (super.noSuchMethod( Invocation.method( #getTransform, [], ), - returnValue: _i22.Float64List(0), - ) as _i22.Float64List); + returnValue: _i24.Float64List(0), + ) as _i24.Float64List); @override void clipRect( - _i13.Rect? rect, { - _i13.ClipOp? clipOp = _i13.ClipOp.intersect, + _i15.Rect? rect, { + _i15.ClipOp? clipOp = _i15.ClipOp.intersect, bool? doAntiAlias = true, }) => super.noSuchMethod( @@ -1094,7 +1189,7 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void clipRRect( - _i13.RRect? rrect, { + _i15.RRect? rrect, { bool? doAntiAlias = true, }) => super.noSuchMethod( @@ -1108,7 +1203,7 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void clipPath( - _i13.Path? path, { + _i15.Path? path, { bool? doAntiAlias = true, }) => super.noSuchMethod( @@ -1121,39 +1216,39 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { ); @override - _i13.Rect getLocalClipBounds() => (super.noSuchMethod( + _i15.Rect getLocalClipBounds() => (super.noSuchMethod( Invocation.method( #getLocalClipBounds, [], ), - returnValue: _FakeRect_13( + returnValue: _FakeRect_15( this, Invocation.method( #getLocalClipBounds, [], ), ), - ) as _i13.Rect); + ) as _i15.Rect); @override - _i13.Rect getDestinationClipBounds() => (super.noSuchMethod( + _i15.Rect getDestinationClipBounds() => (super.noSuchMethod( Invocation.method( #getDestinationClipBounds, [], ), - returnValue: _FakeRect_13( + returnValue: _FakeRect_15( this, Invocation.method( #getDestinationClipBounds, [], ), ), - ) as _i13.Rect); + ) as _i15.Rect); @override void drawColor( - _i13.Color? color, - _i13.BlendMode? blendMode, + _i15.Color? color, + _i15.BlendMode? blendMode, ) => super.noSuchMethod( Invocation.method( @@ -1168,9 +1263,9 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawLine( - _i13.Offset? p1, - _i13.Offset? p2, - _i13.Paint? paint, + _i15.Offset? p1, + _i15.Offset? p2, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1185,7 +1280,7 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { ); @override - void drawPaint(_i13.Paint? paint) => super.noSuchMethod( + void drawPaint(_i15.Paint? paint) => super.noSuchMethod( Invocation.method( #drawPaint, [paint], @@ -1195,8 +1290,8 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawRect( - _i13.Rect? rect, - _i13.Paint? paint, + _i15.Rect? rect, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1211,8 +1306,8 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawRRect( - _i13.RRect? rrect, - _i13.Paint? paint, + _i15.RRect? rrect, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1227,9 +1322,9 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawDRRect( - _i13.RRect? outer, - _i13.RRect? inner, - _i13.Paint? paint, + _i15.RRect? outer, + _i15.RRect? inner, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1245,8 +1340,8 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawOval( - _i13.Rect? rect, - _i13.Paint? paint, + _i15.Rect? rect, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1261,9 +1356,9 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawCircle( - _i13.Offset? c, + _i15.Offset? c, double? radius, - _i13.Paint? paint, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1279,11 +1374,11 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawArc( - _i13.Rect? rect, + _i15.Rect? rect, double? startAngle, double? sweepAngle, bool? useCenter, - _i13.Paint? paint, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1301,8 +1396,8 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawPath( - _i13.Path? path, - _i13.Paint? paint, + _i15.Path? path, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1317,9 +1412,9 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawImage( - _i13.Image? image, - _i13.Offset? offset, - _i13.Paint? paint, + _i15.Image? image, + _i15.Offset? offset, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1335,10 +1430,10 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawImageRect( - _i13.Image? image, - _i13.Rect? src, - _i13.Rect? dst, - _i13.Paint? paint, + _i15.Image? image, + _i15.Rect? src, + _i15.Rect? dst, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1355,10 +1450,10 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawImageNine( - _i13.Image? image, - _i13.Rect? center, - _i13.Rect? dst, - _i13.Paint? paint, + _i15.Image? image, + _i15.Rect? center, + _i15.Rect? dst, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1374,7 +1469,7 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { ); @override - void drawPicture(_i13.Picture? picture) => super.noSuchMethod( + void drawPicture(_i15.Picture? picture) => super.noSuchMethod( Invocation.method( #drawPicture, [picture], @@ -1384,8 +1479,8 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawParagraph( - _i13.Paragraph? paragraph, - _i13.Offset? offset, + _i15.Paragraph? paragraph, + _i15.Offset? offset, ) => super.noSuchMethod( Invocation.method( @@ -1400,9 +1495,9 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawPoints( - _i13.PointMode? pointMode, - List<_i13.Offset>? points, - _i13.Paint? paint, + _i15.PointMode? pointMode, + List<_i15.Offset>? points, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1418,9 +1513,9 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawRawPoints( - _i13.PointMode? pointMode, - _i22.Float32List? points, - _i13.Paint? paint, + _i15.PointMode? pointMode, + _i24.Float32List? points, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1436,9 +1531,9 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawVertices( - _i13.Vertices? vertices, - _i13.BlendMode? blendMode, - _i13.Paint? paint, + _i15.Vertices? vertices, + _i15.BlendMode? blendMode, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1454,13 +1549,13 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawAtlas( - _i13.Image? atlas, - List<_i13.RSTransform>? transforms, - List<_i13.Rect>? rects, - List<_i13.Color>? colors, - _i13.BlendMode? blendMode, - _i13.Rect? cullRect, - _i13.Paint? paint, + _i15.Image? atlas, + List<_i15.RSTransform>? transforms, + List<_i15.Rect>? rects, + List<_i15.Color>? colors, + _i15.BlendMode? blendMode, + _i15.Rect? cullRect, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1480,13 +1575,13 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawRawAtlas( - _i13.Image? atlas, - _i22.Float32List? rstTransforms, - _i22.Float32List? rects, - _i22.Int32List? colors, - _i13.BlendMode? blendMode, - _i13.Rect? cullRect, - _i13.Paint? paint, + _i15.Image? atlas, + _i24.Float32List? rstTransforms, + _i24.Float32List? rects, + _i24.Int32List? colors, + _i15.BlendMode? blendMode, + _i15.Rect? cullRect, + _i15.Paint? paint, ) => super.noSuchMethod( Invocation.method( @@ -1506,8 +1601,8 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { @override void drawShadow( - _i13.Path? path, - _i13.Color? color, + _i15.Path? path, + _i15.Color? color, double? elevation, bool? transparentOccluder, ) => @@ -1528,22 +1623,22 @@ class MockCanvas extends _i1.Mock implements _i13.Canvas { /// A class which mocks [TextCommand]. /// /// See the documentation for Mockito's code generation for more information. -class MockTextCommand extends _i1.Mock implements _i8.TextCommand { +class MockTextCommand extends _i1.Mock implements _i9.TextCommand { MockTextCommand() { _i1.throwOnMissingStub(this); } @override - _i13.Offset get point => (super.noSuchMethod( + _i15.Offset get point => (super.noSuchMethod( Invocation.getter(#point), - returnValue: _FakeOffset_14( + returnValue: _FakeOffset_16( this, Invocation.getter(#point), ), - ) as _i13.Offset); + ) as _i15.Offset); @override - set point(_i13.Offset? _point) => super.noSuchMethod( + set point(_i15.Offset? _point) => super.noSuchMethod( Invocation.setter( #point, _point, @@ -1552,18 +1647,18 @@ class MockTextCommand extends _i1.Mock implements _i8.TextCommand { ); @override - _i14.TextStyle get style => (super.noSuchMethod( + _i16.TextStyle get style => (super.noSuchMethod( Invocation.getter(#style), - returnValue: _FakeTextStyle_15( + returnValue: _FakeTextStyle_17( this, Invocation.getter(#style), ), - ) as _i14.TextStyle); + ) as _i16.TextStyle); @override String get text => (super.noSuchMethod( Invocation.getter(#text), - returnValue: _i21.dummyValue( + returnValue: _i23.dummyValue( this, Invocation.getter(#text), ), @@ -1584,7 +1679,7 @@ class MockTextCommand extends _i1.Mock implements _i8.TextCommand { @override String get type => (super.noSuchMethod( Invocation.getter(#type), - returnValue: _i21.dummyValue( + returnValue: _i23.dummyValue( this, Invocation.getter(#type), ), @@ -1621,16 +1716,16 @@ class MockTextCommand extends _i1.Mock implements _i8.TextCommand { ) as bool); @override - _i13.Paint get paint => (super.noSuchMethod( + _i15.Paint get paint => (super.noSuchMethod( Invocation.getter(#paint), - returnValue: _i21.dummyValue<_i13.Paint>( + returnValue: _i23.dummyValue<_i15.Paint>( this, Invocation.getter(#paint), ), - ) as _i13.Paint); + ) as _i15.Paint); @override - void call(_i13.Canvas? canvas) => super.noSuchMethod( + void call(_i15.Canvas? canvas) => super.noSuchMethod( Invocation.method( #call, [canvas], @@ -1651,76 +1746,76 @@ class MockTextCommand extends _i1.Mock implements _i8.TextCommand { /// A class which mocks [GraphicFactory]. /// /// See the documentation for Mockito's code generation for more information. -class MockGraphicFactory extends _i1.Mock implements _i23.GraphicFactory { +class MockGraphicFactory extends _i1.Mock implements _i25.GraphicFactory { MockGraphicFactory() { _i1.throwOnMissingStub(this); } @override - _i13.Paint createPaint() => (super.noSuchMethod( + _i15.Paint createPaint() => (super.noSuchMethod( Invocation.method( #createPaint, [], ), - returnValue: _i21.dummyValue<_i13.Paint>( + returnValue: _i23.dummyValue<_i15.Paint>( this, Invocation.method( #createPaint, [], ), ), - ) as _i13.Paint); + ) as _i15.Paint); @override - _i15.PathWithActionHistory createPathWithActionHistory() => + _i17.PathWithActionHistory createPathWithActionHistory() => (super.noSuchMethod( Invocation.method( #createPathWithActionHistory, [], ), - returnValue: _FakePathWithActionHistory_16( + returnValue: _FakePathWithActionHistory_18( this, Invocation.method( #createPathWithActionHistory, [], ), ), - ) as _i15.PathWithActionHistory); + ) as _i17.PathWithActionHistory); @override - _i13.PictureRecorder createPictureRecorder() => (super.noSuchMethod( + _i15.PictureRecorder createPictureRecorder() => (super.noSuchMethod( Invocation.method( #createPictureRecorder, [], ), - returnValue: _FakePictureRecorder_17( + returnValue: _FakePictureRecorder_19( this, Invocation.method( #createPictureRecorder, [], ), ), - ) as _i13.PictureRecorder); + ) as _i15.PictureRecorder); @override - _i13.Canvas createCanvasWithRecorder(_i13.PictureRecorder? recorder) => + _i15.Canvas createCanvasWithRecorder(_i15.PictureRecorder? recorder) => (super.noSuchMethod( Invocation.method( #createCanvasWithRecorder, [recorder], ), - returnValue: _FakeCanvas_18( + returnValue: _FakeCanvas_20( this, Invocation.method( #createCanvasWithRecorder, [recorder], ), ), - ) as _i13.Canvas); + ) as _i15.Canvas); @override - _i13.Paint createWatercolorPaint( - _i13.Paint? originalPaint, + _i15.Paint createWatercolorPaint( + _i15.Paint? originalPaint, double? blurSigma, ) => (super.noSuchMethod( @@ -1731,7 +1826,7 @@ class MockGraphicFactory extends _i1.Mock implements _i23.GraphicFactory { blurSigma, ], ), - returnValue: _i21.dummyValue<_i13.Paint>( + returnValue: _i23.dummyValue<_i15.Paint>( this, Invocation.method( #createWatercolorPaint, @@ -1741,43 +1836,43 @@ class MockGraphicFactory extends _i1.Mock implements _i23.GraphicFactory { ], ), ), - ) as _i13.Paint); + ) as _i15.Paint); @override - _i13.Paint copyPaint(_i13.Paint? original) => (super.noSuchMethod( + _i15.Paint copyPaint(_i15.Paint? original) => (super.noSuchMethod( Invocation.method( #copyPaint, [original], ), - returnValue: _i21.dummyValue<_i13.Paint>( + returnValue: _i23.dummyValue<_i15.Paint>( this, Invocation.method( #copyPaint, [original], ), ), - ) as _i13.Paint); + ) as _i15.Paint); } /// A class which mocks [BoundingBox]. /// /// See the documentation for Mockito's code generation for more information. -class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { +class MockBoundingBox extends _i1.Mock implements _i26.BoundingBox { MockBoundingBox() { _i1.throwOnMissingStub(this); } @override - _i13.Offset get center => (super.noSuchMethod( + _i15.Offset get center => (super.noSuchMethod( Invocation.getter(#center), - returnValue: _FakeOffset_14( + returnValue: _FakeOffset_16( this, Invocation.getter(#center), ), - ) as _i13.Offset); + ) as _i15.Offset); @override - set center(_i13.Offset? _center) => super.noSuchMethod( + set center(_i15.Offset? _center) => super.noSuchMethod( Invocation.setter( #center, _center, @@ -1831,13 +1926,13 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - _i25.BoundingBoxAction get currentAction => (super.noSuchMethod( + _i27.BoundingBoxAction get currentAction => (super.noSuchMethod( Invocation.getter(#currentAction), - returnValue: _i25.BoundingBoxAction.none, - ) as _i25.BoundingBoxAction); + returnValue: _i27.BoundingBoxAction.none, + ) as _i27.BoundingBoxAction); @override - set currentAction(_i25.BoundingBoxAction? _currentAction) => + set currentAction(_i27.BoundingBoxAction? _currentAction) => super.noSuchMethod( Invocation.setter( #currentAction, @@ -1847,15 +1942,15 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - _i26.BoundingBoxResizeAction get currentBoundingBoxResizeAction => + _i28.BoundingBoxResizeAction get currentBoundingBoxResizeAction => (super.noSuchMethod( Invocation.getter(#currentBoundingBoxResizeAction), - returnValue: _i26.BoundingBoxResizeAction.none, - ) as _i26.BoundingBoxResizeAction); + returnValue: _i28.BoundingBoxResizeAction.none, + ) as _i28.BoundingBoxResizeAction); @override set currentBoundingBoxResizeAction( - _i26.BoundingBoxResizeAction? _currentBoundingBoxResizeAction) => + _i28.BoundingBoxResizeAction? _currentBoundingBoxResizeAction) => super.noSuchMethod( Invocation.setter( #currentBoundingBoxResizeAction, @@ -1865,7 +1960,7 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - set lastDragGlobalPosition(_i13.Offset? _lastDragGlobalPosition) => + set lastDragGlobalPosition(_i15.Offset? _lastDragGlobalPosition) => super.noSuchMethod( Invocation.setter( #lastDragGlobalPosition, @@ -1875,7 +1970,7 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - set dragStartLocalPosition(_i13.Offset? _dragStartLocalPosition) => + set dragStartLocalPosition(_i15.Offset? _dragStartLocalPosition) => super.noSuchMethod( Invocation.setter( #dragStartLocalPosition, @@ -1901,16 +1996,16 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - _i13.Paint get boxPaint => (super.noSuchMethod( + _i15.Paint get boxPaint => (super.noSuchMethod( Invocation.getter(#boxPaint), - returnValue: _i21.dummyValue<_i13.Paint>( + returnValue: _i23.dummyValue<_i15.Paint>( this, Invocation.getter(#boxPaint), ), - ) as _i13.Paint); + ) as _i15.Paint); @override - set boxPaint(_i13.Paint? _boxPaint) => super.noSuchMethod( + set boxPaint(_i15.Paint? _boxPaint) => super.noSuchMethod( Invocation.setter( #boxPaint, _boxPaint, @@ -1919,16 +2014,16 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - _i13.Paint get handlePaint => (super.noSuchMethod( + _i15.Paint get handlePaint => (super.noSuchMethod( Invocation.getter(#handlePaint), - returnValue: _i21.dummyValue<_i13.Paint>( + returnValue: _i23.dummyValue<_i15.Paint>( this, Invocation.getter(#handlePaint), ), - ) as _i13.Paint); + ) as _i15.Paint); @override - set handlePaint(_i13.Paint? _handlePaint) => super.noSuchMethod( + set handlePaint(_i15.Paint? _handlePaint) => super.noSuchMethod( Invocation.setter( #handlePaint, _handlePaint, @@ -1937,16 +2032,16 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - _i13.Paint get rotationHandlePaint => (super.noSuchMethod( + _i15.Paint get rotationHandlePaint => (super.noSuchMethod( Invocation.getter(#rotationHandlePaint), - returnValue: _i21.dummyValue<_i13.Paint>( + returnValue: _i23.dummyValue<_i15.Paint>( this, Invocation.getter(#rotationHandlePaint), ), - ) as _i13.Paint); + ) as _i15.Paint); @override - set rotationHandlePaint(_i13.Paint? _rotationHandlePaint) => + set rotationHandlePaint(_i15.Paint? _rotationHandlePaint) => super.noSuchMethod( Invocation.setter( #rotationHandlePaint, @@ -1971,25 +2066,25 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - _i13.Rect get rect => (super.noSuchMethod( + _i15.Rect get rect => (super.noSuchMethod( Invocation.getter(#rect), - returnValue: _FakeRect_13( + returnValue: _FakeRect_15( this, Invocation.getter(#rect), ), - ) as _i13.Rect); + ) as _i15.Rect); @override - List<_i13.Offset> getCorners() => (super.noSuchMethod( + List<_i15.Offset> getCorners() => (super.noSuchMethod( Invocation.method( #getCorners, [], ), - returnValue: <_i13.Offset>[], - ) as List<_i13.Offset>); + returnValue: <_i15.Offset>[], + ) as List<_i15.Offset>); @override - void determineAction(_i13.Offset? globalPoint) => super.noSuchMethod( + void determineAction(_i15.Offset? globalPoint) => super.noSuchMethod( Invocation.method( #determineAction, [globalPoint], @@ -1998,7 +2093,7 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - void updateDrag(_i13.Offset? globalPoint) => super.noSuchMethod( + void updateDrag(_i15.Offset? globalPoint) => super.noSuchMethod( Invocation.method( #updateDrag, [globalPoint], @@ -2016,7 +2111,7 @@ class MockBoundingBox extends _i1.Mock implements _i24.BoundingBox { ); @override - void drawGuides(_i13.Canvas? canvas) => super.noSuchMethod( + void drawGuides(_i15.Canvas? canvas) => super.noSuchMethod( Invocation.method( #drawGuides, [canvas], diff --git a/test/unit/workspace/render_image_for_export_test.mocks.dart b/test/unit/workspace/render_image_for_export_test.mocks.dart index b8276da8..45d34a79 100644 --- a/test/unit/workspace/render_image_for_export_test.mocks.dart +++ b/test/unit/workspace/render_image_for_export_test.mocks.dart @@ -677,6 +677,15 @@ class MockCommandManager extends _i1.Mock implements _i6.CommandManager { returnValueForMissingStub: null, ); + @override + void removeCommand(_i3.Command? commandToRemove) => super.noSuchMethod( + Invocation.method( + #removeCommand, + [commandToRemove], + ), + returnValueForMissingStub: null, + ); + @override void setUndoStack(List<_i3.Command>? commands) => super.noSuchMethod( Invocation.method( diff --git a/test/widget/workspace_page/clipping_tool_test.dart b/test/widget/workspace_page/clipping_tool_test.dart new file mode 100644 index 00000000..40845228 --- /dev/null +++ b/test/widget/workspace_page/clipping_tool_test.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:paintroid/app.dart'; +import 'package:paintroid/core/tools/tool_data.dart'; +import '../../utils/test_utils.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + late Widget sut; + + setUp(() async => sut = ProviderScope(child: App(showOnboardingPage: false))); + + testWidgets('[CLIPPING_TOOL]: selecting clipping tool shows checkmark', + (WidgetTester tester) async { + UIInteraction.initialize(tester); + await tester.pumpWidget(sut); + await UIInteraction.createNewImage(); + + expect(WidgetFinder.checkMark, findsNothing); + + await UIInteraction.selectTool(ToolData.CLIPPING.name); + + expect(WidgetFinder.checkMark, findsOneWidget); + }); + + testWidgets('[CLIPPING_TOOL]: selecting other tools hide the checkmark', + (WidgetTester tester) async { + UIInteraction.initialize(tester); + await tester.pumpWidget(sut); + await UIInteraction.createNewImage(); + + expect(WidgetFinder.checkMark, findsNothing); + + await UIInteraction.selectTool(ToolData.CLIPPING.name); + + expect(WidgetFinder.checkMark, findsOneWidget); + + await UIInteraction.selectTool(ToolData.BRUSH.name); + + expect(WidgetFinder.checkMark, findsNothing); + }); +}