You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
samples/animations/test/misc/animated_positioned_test.dart

34 lines
1.1 KiB

// Copyright 2020 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:animations/src/misc/animated_positioned.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Widget createAnimatedPositionedDemoScreen() => const MaterialApp(
home: AnimatedPositionedDemo(),
);
void main() {
group('AnimatedPositioned Tests', () {
testWidgets('Position of Button Changes on Tap', (tester) async {
await tester.pumpWidget(createAnimatedPositionedDemoScreen());
var button = find.byType(InkWell);
// Get initial position of the widget.
var initialPosition = tester.getTopLeft(button);
expect(initialPosition, isNotNull);
// Tap on the widget.
await tester.tap(button);
await tester.pumpAndSettle();
// The new position should not be equal to initial position.
var newPosition = tester.getTopLeft(button);
expect(newPosition, isNot(offsetMoreOrLessEquals(initialPosition)));
});
});
}