snapshot of https://github.com/flutter/samples.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Main Branch CI / Test Flutter beta on ubuntu-latest (push) Has been skipped
Main Branch CI / Test Flutter stable on ubuntu-latest (push) Has been skipped
Main Branch CI / Test Flutter beta on macos-latest (push) Has been cancelled
Main Branch CI / Test Flutter stable on macos-latest (push) Has been cancelled
Some checks failed
Main Branch CI / Test Flutter beta on ubuntu-latest (push) Has been skipped
Main Branch CI / Test Flutter stable on ubuntu-latest (push) Has been skipped
Main Branch CI / Test Flutter beta on macos-latest (push) Has been cancelled
Main Branch CI / Test Flutter stable on macos-latest (push) Has been cancelled
This commit is contained in:
32
animations/test/misc/animated_positioned_test.dart
Normal file
32
animations/test/misc/animated_positioned_test.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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)));
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user