Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
62 lines
2.2 KiB
Dart
62 lines
2.2 KiB
Dart
import 'package:cutdex/app/editor_theme.dart';
|
||
import 'package:cutdex/features/properties/project_properties.dart';
|
||
import 'package:cutdex/l10n/app_localizations.dart';
|
||
import 'package:cutdex_core/editor.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
|
||
import 'support/preview_fixture.dart';
|
||
|
||
void main() {
|
||
testWidgets(
|
||
'canvas edits refresh values while preserving property shell and labels',
|
||
(tester) async {
|
||
final fixture = (await tester.runAsync(
|
||
() =>
|
||
createPreviewFixture(Uri.file('/fixture.png'), mediaType: 'image'),
|
||
))!;
|
||
addTearDown(
|
||
() => tester.runAsync(() async {
|
||
await fixture.workspace.close();
|
||
await fixture.directory.delete(recursive: true);
|
||
}),
|
||
);
|
||
await tester.pumpWidget(
|
||
MaterialApp(
|
||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||
supportedLocales: AppLocalizations.supportedLocales,
|
||
locale: const Locale('zh'),
|
||
theme: EditorTheme.penDark,
|
||
home: Scaffold(
|
||
body: SizedBox(
|
||
width: 280,
|
||
child: ProjectProperties(session: fixture.timeline),
|
||
),
|
||
),
|
||
),
|
||
);
|
||
await tester.pumpAndSettle();
|
||
final label = tester.element(find.text('画布尺寸'));
|
||
final value = tester.element(find.text('1080 × 1920 px'));
|
||
final previous = debugOnRebuildDirtyWidget;
|
||
var shellBuilds = 0;
|
||
var labelBuilds = 0;
|
||
debugOnRebuildDirtyWidget = (element, built) {
|
||
previous?.call(element, built);
|
||
if (element.widget is ProjectProperties) shellBuilds++;
|
||
if (identical(element, label)) labelBuilds++;
|
||
};
|
||
addTearDown(() => debugOnRebuildDirtyWidget = previous);
|
||
fixture.timeline.commands.setCanvas(ProjectCanvas.widescreen);
|
||
await tester.pumpAndSettle();
|
||
expect(find.text('1920 × 1080 px'), findsOneWidget);
|
||
expect(tester.element(find.text('1920 × 1080 px')), same(value));
|
||
expect(shellBuilds, 0);
|
||
expect(labelBuilds, 0);
|
||
expect(tester.takeException(), isNull);
|
||
await tester.pumpWidget(const SizedBox());
|
||
await tester.runAsync(fixture.timeline.flush);
|
||
},
|
||
);
|
||
}
|