add golden tests for CupertinoDatePicker (#30828)
Add golden tests for CupertinoDatePicker
This commit is contained in:
@@ -1 +1 @@
|
||||
894e9634cda6eb940d1ad4efb20b63a174bb7797
|
||||
cb8264b1953000a603ecc2659ece3483859438a1
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2017 The Chromium 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 'dart:io' show Platform;
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -811,6 +813,37 @@ void main() {
|
||||
expect(lastSelectedItem, 1);
|
||||
handle.dispose();
|
||||
});
|
||||
|
||||
testWidgets('DatePicker golden tests', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
CupertinoApp(
|
||||
home: SizedBox(
|
||||
width: 200,
|
||||
child: CupertinoDatePicker(
|
||||
mode: CupertinoDatePickerMode.dateAndTime,
|
||||
initialDateTime: DateTime(2019, 1, 1, 4),
|
||||
onDateTimeChanged: (_) {},
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
await expectLater(
|
||||
find.byType(CupertinoDatePicker),
|
||||
matchesGoldenFile('date_picker_test.datetime.initial.png'),
|
||||
skip: !Platform.isLinux
|
||||
);
|
||||
|
||||
// Slightly drag the hour component to make the current hour off-center.
|
||||
await tester.drag(find.text('4'), Offset(0, _kRowOffset.dy / 2));
|
||||
await tester.pump();
|
||||
|
||||
await expectLater(
|
||||
find.byType(CupertinoDatePicker),
|
||||
matchesGoldenFile('date_picker_test.datetime.drag.png'),
|
||||
skip: !Platform.isLinux
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildPicker({ FixedExtentScrollController controller, ValueChanged<int> onSelectedItemChanged }) {
|
||||
|
||||
Reference in New Issue
Block a user