"Fossies" - the Fresh Open Source Software Archive

Member "flutter-3.7.1/packages/flutter_test/test/accessibility_window_test.dart" (1 Feb 2023, 1626 Bytes) of package /linux/misc/flutter-3.7.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Copyright 2014 The Flutter Authors. All rights reserved.
    2 // Use of this source code is governed by a BSD-style license that can be
    3 // found in the LICENSE file.
    4 
    5 import 'package:flutter/material.dart';
    6 import 'package:flutter_test/flutter_test.dart';
    7 
    8 void main() {
    9   testWidgets('Fails correctly with configured screen size - small', (WidgetTester tester) async {
   10     tester.binding.window.devicePixelRatioTestValue = 1.2;
   11     tester.binding.window.physicalSizeTestValue = const Size(250, 300);
   12 
   13     final Widget invalidButton = ElevatedButton(
   14       onPressed: () {},
   15       style: ElevatedButton.styleFrom(
   16         foregroundColor: Colors.orange,
   17         backgroundColor: Colors.orangeAccent,
   18       ),
   19       child: const Text('Button'),
   20     );
   21     await tester.pumpWidget(MaterialApp(home: Scaffold(body: invalidButton)));
   22 
   23     final Evaluation result = await textContrastGuideline.evaluate(tester);
   24     expect(result.passed, false);
   25   });
   26 
   27   testWidgets('Fails correctly with configured screen size - large', (WidgetTester tester) async {
   28     tester.binding.window.devicePixelRatioTestValue = 4.2;
   29     tester.binding.window.physicalSizeTestValue = const Size(2500, 3000);
   30 
   31     final Widget invalidButton = ElevatedButton(
   32       onPressed: () {},
   33       style: ElevatedButton.styleFrom(
   34         foregroundColor: Colors.orange,
   35         backgroundColor: Colors.orangeAccent,
   36       ),
   37       child: const Text('Button'),
   38     );
   39     await tester.pumpWidget(MaterialApp(home: Scaffold(body: invalidButton)));
   40 
   41     final Evaluation result = await textContrastGuideline.evaluate(tester);
   42     expect(result.passed, false);
   43   });
   44 }