Add test for media_query_data.system_gesture_insets.0.dart (#157854)

Contributes to https://github.com/flutter/flutter/issues/130459

It adds a test for
- `examples/api/lib/widgets/media_query/media_query_data.system_gesture_insets.0.dart`
This commit is contained in:
Valentin Vignal
2024-10-31 18:47:14 +08:00
committed by GitHub
parent fb022290ff
commit 16622e67a0
2 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
// 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/media_query/media_query_data.system_gesture_insets.0.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('The slider should be padded with the system gesture insets', (WidgetTester tester) async {
tester.view.systemGestureInsets = const FakeViewPadding(left: 60, right: 60);
await tester.pumpWidget(
const example.SystemGestureInsetsExampleApp(),
);
expect(find.widgetWithText(AppBar, 'Pad Slider to avoid systemGestureInsets'), findsOne);
final Rect rect = tester.getRect(find.byType(Slider));
expect(rect, rectMoreOrLessEquals(const Rect.fromLTRB(20.0, 56.0, 780.0, 600.0)));
});
}