flutter/examples/api/test/widgets/implicit_animations/animated_slide.0_test.dart
Hans Muller 0d4b5ae122
Dev, examples/api, etc updated for Material 3 by default (#129683)
Updated tests in dev, examples/api, and tests/widgets to ensure that
they continue to pass when the default for `ThemeData.useMaterial3` is
changed to true.

This is the final set of changes required for
https://github.com/flutter/flutter/issues/127064.
2023-06-28 09:41:58 -07:00

38 lines
1.3 KiB
Dart

// Copyright 2014 The Flutter Authors. 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:flutter/material.dart';
import 'package:flutter_api_samples/widgets/implicit_animations/animated_slide.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Translate FlutterLogo using AnimatedSlide', (WidgetTester tester) async {
await tester.pumpWidget(
const example.AnimatedSlideApp(),
);
Offset logoOffset = tester.getCenter(find.byType(FlutterLogo));
expect(logoOffset.dx, 376.0);
expect(logoOffset.dy, 304.0);
// Test Y axis slider.
final Offset y = tester.getCenter(find.text('Y'));
await tester.tapAt(Offset(y.dx, y.dy + 100));
await tester.pumpAndSettle();
logoOffset = tester.getCenter(find.byType(FlutterLogo));
expect(logoOffset.dx.roundToDouble(), 376.0);
expect(logoOffset.dy.roundToDouble(), 137.0);
// Test X axis slider.
final Offset x = tester.getCenter(find.text('X'));
await tester.tapAt(Offset(x.dx + 100, x.dy));
await tester.pumpAndSettle();
logoOffset = tester.getCenter(find.byType(FlutterLogo));
expect(logoOffset.dx.roundToDouble(), 178.0);
expect(logoOffset.dy.roundToDouble(), 137.0);
});
}