flutter/examples/api/test/material/switch/switch.3_test.dart
Pierre-Louis 1e696d304c
Support theming CupertinoSwitchs (#116510)
* Introduce flag to maximally apply CupertinoTheme

* add missing docs

* add tests

* fix docs

* fix test
2022-12-06 15:32:58 +01:00

25 lines
825 B
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/material/switch/switch.3.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Can toggle switch', (WidgetTester tester) async {
await tester.pumpWidget(
const example.SwitchApp(),
);
final Finder switchFinder = find.byType(Switch).first;
Switch materialSwitch = tester.widget<Switch>(switchFinder);
expect(materialSwitch.value, true);
await tester.tap(switchFinder);
await tester.pumpAndSettle();
materialSwitch = tester.widget<Switch>(switchFinder);
expect(materialSwitch.value, false);
});
}