test: align property fixtures with scrollable inspector layout
Host PictureProperties in the same scrolling layout used by the inspector, scope scrub labels and transform field assertions to the controls under test, and compare resolved temporary paths in tool tests on macOS. Validation: full application analysis, 1261 Flutter tests passed (9 skipped), generated-code verification, and 171 tool tests.
This commit is contained in:
1 parent
789af7a68e
commit
4912aa1ab0
4 files changed
+35
-19
No files matched your search
@@ -1186,6 +1186,7 @@ void main() {
|
||||
home: Scaffold(
|
||||
body: SizedBox(
|
||||
width: 225,
|
||||
child: SingleChildScrollView(
|
||||
child: PictureProperties(
|
||||
projectId: projectId,
|
||||
timelineId: 'project',
|
||||
@@ -1199,13 +1200,17 @@ void main() {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
if (action == 'unlocked') {
|
||||
await tester.tap(find.byKey(const Key('picture-lock')));
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
final label = find.text(labelText);
|
||||
final label = find.descendant(
|
||||
of: find.byKey(ValueKey(fieldKey)),
|
||||
matching: find.text(labelText),
|
||||
);
|
||||
final gesture = await tester.startGesture(
|
||||
tester.getCenter(label),
|
||||
kind: PointerDeviceKind.mouse,
|
||||
@@ -1364,12 +1369,16 @@ void main() {
|
||||
home: Scaffold(
|
||||
body: SizedBox(
|
||||
width: 225,
|
||||
child: SingleChildScrollView(
|
||||
child: PictureProperties(
|
||||
projectId: projectId,
|
||||
timelineId: 'project',
|
||||
session: session,
|
||||
sequence: id,
|
||||
clip: base.query().element(base.query().elementById(clipId)!),
|
||||
clip: base.query().element(
|
||||
base.query().elementById(clipId)!,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1377,15 +1386,23 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
String text(String key) => tester
|
||||
.widget<TextField>(
|
||||
TextField field(String key) => tester.widget<TextField>(
|
||||
find.descendant(
|
||||
of: find.byKey(ValueKey(key)),
|
||||
matching: find.byType(TextField),
|
||||
),
|
||||
)
|
||||
.controller!
|
||||
.text;
|
||||
);
|
||||
String text(String key) => field(key).controller!.text;
|
||||
Iterable<TextField> transformFields() => [
|
||||
for (final key in [
|
||||
'picture-x',
|
||||
'picture-y',
|
||||
'picture-scale-x',
|
||||
'picture-scale-y',
|
||||
'picture-rotation',
|
||||
])
|
||||
field(key),
|
||||
];
|
||||
PreviewVisual visual(ClipTransform value) => PreviewVisual(
|
||||
layerId: 'video',
|
||||
elementId: clipId,
|
||||
@@ -1499,9 +1516,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
for (final field in tester.widgetList<TextField>(
|
||||
find.byType(TextField),
|
||||
)) {
|
||||
for (final field in transformFields()) {
|
||||
expect(field.enabled, isTrue);
|
||||
expect(field.readOnly, isTrue);
|
||||
expect(field.canRequestFocus, isFalse);
|
||||
@@ -1523,9 +1538,7 @@ void main() {
|
||||
}
|
||||
await edit.end();
|
||||
await tester.pump();
|
||||
for (final field in tester.widgetList<TextField>(
|
||||
find.byType(TextField),
|
||||
)) {
|
||||
for (final field in transformFields()) {
|
||||
expect(field.enabled, isTrue);
|
||||
expect(field.readOnly, isFalse);
|
||||
expect(field.canRequestFocus, isTrue);
|
||||
@@ -1790,6 +1803,7 @@ void main() {
|
||||
home: Scaffold(
|
||||
body: SizedBox(
|
||||
width: 225,
|
||||
child: SingleChildScrollView(
|
||||
child: ListenableBuilder(
|
||||
listenable: view,
|
||||
builder: (_, _) {
|
||||
@@ -1807,6 +1821,7 @@ void main() {
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
Future<void> input(String field, String text) async {
|
||||
|
||||
@@ -21,7 +21,7 @@ class CommonToolsTests(unittest.TestCase):
|
||||
result = run([sys.executable, '-c', code, *arguments], cwd=directory,
|
||||
env={'CUTDEX_TEST': 'child'}, capture_output=True, text=True)
|
||||
lines = result.stdout.splitlines()
|
||||
self.assertEqual(Path(lines[0]), Path(directory))
|
||||
self.assertEqual(Path(lines[0]).resolve(), Path(directory).resolve())
|
||||
self.assertEqual(lines[1], 'child')
|
||||
self.assertEqual(lines[2], repr(arguments))
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ sys.exit(7 if 'fail' in sys.argv else 0)
|
||||
self.assertEqual(data['parent'], 'parent')
|
||||
self.assertEqual(data['android'], 'C:/My SDK/cutdex_android')
|
||||
self.assertEqual(data['input'], 'daemon-request')
|
||||
self.assertEqual(Path(data['cwd']), self.root)
|
||||
self.assertEqual(Path(data['cwd']).resolve(), self.root.resolve())
|
||||
self.assertEqual(result.stderr.strip(), 'flutter-diagnostic')
|
||||
|
||||
def test_ide_shim_uses_the_same_loader_and_preserves_arguments(self):
|
||||
@@ -168,7 +168,7 @@ sys.exit(7 if 'fail' in sys.argv else 0)
|
||||
text=True, encoding='utf-8', timeout=40)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
data = json.loads(result.stdout)
|
||||
self.assertEqual(Path(data['cwd']), source)
|
||||
self.assertEqual(Path(data['cwd']).resolve(), source.resolve())
|
||||
self.assertEqual(data['file'], 'main-project')
|
||||
self.assertEqual(data['args'], ['build', 'windows'])
|
||||
|
||||
@@ -228,7 +228,8 @@ sys.exit(7 if 'fail' in sys.argv else 0)
|
||||
capture_output=True, text=True, encoding='utf-8', timeout=40)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
data = json.loads(result.stdout)
|
||||
self.assertEqual(Path(data['cwd']), self.root if cwd is None else cwd)
|
||||
expected_cwd = self.root if cwd is None else cwd
|
||||
self.assertEqual(Path(data['cwd']).resolve(), expected_cwd.resolve())
|
||||
self.assertEqual(data['file'], 'selected-project')
|
||||
self.assertEqual(data['input'], 'request')
|
||||
self.assertEqual(data['args'], ['build', 'macos', '--release', '--flavor', 'production',
|
||||
@@ -262,7 +263,7 @@ sys.exit(7 if 'fail' in sys.argv else 0)
|
||||
result = subprocess.run([sys.executable, str(self.root / 'tool/project_tools.py'), 'dart', str(probe)],
|
||||
cwd=package, env=self.environment, capture_output=True, text=True, timeout=40)
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(Path(result.stdout.strip()), package)
|
||||
self.assertEqual(Path(result.stdout.strip()).resolve(), package.resolve())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -198,7 +198,7 @@ class NativeCacheTests(unittest.TestCase):
|
||||
with patch.object(cache, 'download_archive', side_effect=self.download):
|
||||
archive = cache.prepare(environment=environment)
|
||||
self.assertEqual(output.read_text(), f'EXISTING=value\nDESKUP_VELOPACK_ARCHIVE={archive.as_posix()}\n')
|
||||
self.assertEqual(archive.parent, self.root / 'Cutdex/ci-tools/native')
|
||||
self.assertEqual(archive.parent.resolve(), (self.root / 'Cutdex/ci-tools/native').resolve())
|
||||
|
||||
def test_failed_verification_cannot_export_an_archive(self):
|
||||
output = self.root / 'github-env'
|
||||
|
||||
Reference in new issue
Block a user