Add test for build_owner.0.dart (#157499)

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

It adds a test for
- `examples/api/lib/widgets/framework/build_owner.0.dart`
This commit is contained in:
Valentin Vignal
2024-10-25 15:13:22 +08:00
committed by GitHub
parent ffb1239801
commit 086c07cc05
3 changed files with 50 additions and 8 deletions

View File

@@ -0,0 +1,22 @@
// 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/framework/build_owner.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('BuildOwnerExample displays the measured size', (WidgetTester tester) async {
await tester.pumpWidget(const example.BuildOwnerExample());
expect(find.text('Size(640.0, 480.0)'), findsOne);
});
test('The size of the widget is measured', () {
expect(
example.measureWidget(const SizedBox(width: 234, height: 567)),
const Size(234, 567),
);
});
}