From 7ebe0c8e2e9df524367bda5a8e6fa94ce76b7156 Mon Sep 17 00:00:00 2001 From: lingjhf Date: Sat, 10 Oct 2026 22:43:35 +0800 Subject: [PATCH] feat(inspector): separate input and output color controls Give video clips a dedicated color tab with immediate input interpretation, automatic detection, and reset controls. Clarify project output color space, source-stream scope, and unavailable metadata across localized UI text. Share unknown-source color defaults with the SDK and retain independent property tab scroll state. Include localized resources and control previews. Validation: full application analysis, 1261 Flutter tests passed (9 skipped), generated-code verification, and 171 tool tests. --- .../color_interpretation_controls.dart | 87 +++++++++++++++++++ ...olor_interpretation_controls_previews.dart | 79 +++++++++++++++++ .../color_interpretation_properties.dart | 83 +++--------------- .../properties/project_properties.dart | 4 +- .../properties/project_settings_dialog.dart | 6 +- .../properties/properties_content.dart | 29 +++---- .../properties_inspector_controller.dart | 1 + .../properties_presentation_state.dart | 2 + lib/l10n/app_de.arb | 6 +- lib/l10n/app_en.arb | 6 +- lib/l10n/app_es.arb | 6 +- lib/l10n/app_fr.arb | 6 +- lib/l10n/app_it.arb | 6 +- lib/l10n/app_ja.arb | 6 +- lib/l10n/app_ko.arb | 6 +- lib/l10n/app_localizations.dart | 24 +++-- lib/l10n/app_localizations_de.dart | 12 ++- lib/l10n/app_localizations_en.dart | 11 ++- lib/l10n/app_localizations_es.dart | 11 ++- lib/l10n/app_localizations_fr.dart | 12 ++- lib/l10n/app_localizations_it.dart | 12 ++- lib/l10n/app_localizations_ja.dart | 11 ++- lib/l10n/app_localizations_ko.dart | 11 ++- lib/l10n/app_localizations_pt.dart | 11 ++- lib/l10n/app_localizations_ru.dart | 12 ++- lib/l10n/app_localizations_zh.dart | 30 +++++-- lib/l10n/app_pt.arb | 6 +- lib/l10n/app_ru.arb | 6 +- lib/l10n/app_zh.arb | 6 +- lib/l10n/app_zh_Hans.arb | 6 +- lib/l10n/app_zh_Hant.arb | 6 +- lib/workspace/media_color_interpretation.dart | 4 +- test/media_color_interpretation_test.dart | 68 +++++++++++---- test/project_properties_test.dart | 4 +- test/properties_scroll_state_test.dart | 24 +++-- 35 files changed, 449 insertions(+), 171 deletions(-) create mode 100644 lib/features/properties/color_interpretation_controls.dart create mode 100644 lib/features/properties/color_interpretation_controls_previews.dart diff --git a/lib/features/properties/color_interpretation_controls.dart b/lib/features/properties/color_interpretation_controls.dart new file mode 100644 index 0000000..9248626 --- /dev/null +++ b/lib/features/properties/color_interpretation_controls.dart @@ -0,0 +1,87 @@ +import 'package:cutdex/l10n/l10n.dart'; +import 'package:cutdex_ui/icons.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; + +class ColorInterpretationControls extends StatelessWidget { + const ColorInterpretationControls({ + super.key, + required this.value, + this.notice, + required this.options, + this.onChanged, + }); + + final String value; + final String? notice; + final List> options; + final ValueChanged? onChanged; + + @override + Widget build(BuildContext context) { + final secondary = Theme.of(context).colorScheme.onSurfaceVariant; + final desktop = AppTheme.isDesktop(context); + return AppPropertySection( + bottomSpacing: desktop ? AppSpacing.small : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + children: [ + Expanded( + flex: 4, + child: Tooltip( + message: context.l10n.mediaColorInterpretationScope, + child: Text( + context.l10n.mediaInputColorSpace, + style: AppTheme.propertySectionTitleStyle(context), + ), + ), + ), + Expanded( + flex: 6, + child: AppSelect( + key: const Key('media-color-menu'), + emptyLabel: context.l10n.noMatchingOptions, + outlined: false, + controlHeight: desktop ? AppInspectorMetrics.input : 32, + label: context.l10n.mediaInputColorSpace, + value: value, + onChanged: onChanged, + options: options, + ), + ), + IconButton( + key: const Key('media-color-reset'), + tooltip: context.l10n.resetMediaColorInterpretation, + icon: const Icon(AppIcons.reset, size: 16), + style: IconButton.styleFrom( + minimumSize: Size.square( + desktop ? AppInspectorMetrics.action : 40, + ), + padding: EdgeInsets.zero, + tapTargetSize: desktop + ? MaterialTapTargetSize.shrinkWrap + : MaterialTapTargetSize.padded, + ), + onPressed: value == 'auto' || onChanged == null + ? null + : () => onChanged!('auto'), + ), + ], + ), + if (notice != null) ...[ + const SizedBox(height: 2), + Text( + notice!, + key: const Key('media-color-status'), + style: Theme.of(context).textTheme.bodySmall + ?.copyWith(color: secondary), + ), + ], + ], + ), + ); + } +} diff --git a/lib/features/properties/color_interpretation_controls_previews.dart b/lib/features/properties/color_interpretation_controls_previews.dart new file mode 100644 index 0000000..fdc3ca1 --- /dev/null +++ b/lib/features/properties/color_interpretation_controls_previews.dart @@ -0,0 +1,79 @@ +import 'package:cutdex/l10n/app_localizations.dart'; +import 'package:cutdex_ui/theme.dart'; +import 'package:cutdex_ui/widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/widget_previews.dart'; + +import 'color_interpretation_controls.dart'; + +@Preview( + name: 'Color — narrow automatic', + group: 'Properties', + size: Size(220, 220), +) +Widget narrowColorControlsPreview() => _host(desktop: true); + +@Preview( + name: 'Color — manual light', + group: 'Properties', + size: Size(280, 220), +) +Widget manualColorControlsPreview() => + _host(desktop: true, brightness: Brightness.light, value: 'rec2020HLG'); + +@Preview(name: 'Color — loading', group: 'Properties', size: Size(260, 220)) +Widget loadingColorControlsPreview() => _host(desktop: true, loading: true); + +@Preview(name: 'Color — mobile', group: 'Properties', size: Size(400, 260)) +Widget mobileColorControlsPreview() => _host(desktop: false); + +Widget _host({ + required bool desktop, + Brightness brightness = Brightness.dark, + String value = 'auto', + bool loading = false, +}) { + final theme = AppTheme.forPalette(AppPalette.graphite, brightness); + return MaterialApp( + debugShowCheckedModeBanner: false, + locale: const Locale('zh'), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: AppTheme.propertiesPanelTheme( + desktop ? AppTheme.desktopWorkspaceTheme(theme) : theme, + ), + home: Scaffold( + body: _ColorControlsPreview(initialValue: value, loading: loading), + ), + ); +} + +class _ColorControlsPreview extends StatefulWidget { + const _ColorControlsPreview({ + required this.initialValue, + required this.loading, + }); + final String initialValue; + final bool loading; + + @override + State<_ColorControlsPreview> createState() => _ColorControlsPreviewState(); +} + +class _ColorControlsPreviewState extends State<_ColorControlsPreview> { + late String _value = widget.initialValue; + + @override + Widget build(BuildContext context) => ColorInterpretationControls( + value: _value, + notice: widget.loading ? '色彩信息未读取' : null, + onChanged: widget.loading + ? null + : (value) => setState(() => _value = value), + options: [ + AppSelectOption('auto', widget.loading ? '自动' : '自动 · Rec.709'), + const AppSelectOption('rec709', 'Rec.709'), + const AppSelectOption('rec2020HLG', 'Rec.2020 HLG'), + ], + ); +} diff --git a/lib/features/properties/color_interpretation_properties.dart b/lib/features/properties/color_interpretation_properties.dart index 12c9026..00224f6 100644 --- a/lib/features/properties/color_interpretation_properties.dart +++ b/lib/features/properties/color_interpretation_properties.dart @@ -4,10 +4,10 @@ import 'package:cutdex_sdk/runtime.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:cutdex_ui/theme.dart'; import 'package:cutdex_ui/widgets.dart'; import '../../workspace/media_color_interpretation.dart'; +import 'color_interpretation_controls.dart'; import '../../shared/widgets/listenable_selector.dart'; import '../../workspace/timeline_session.dart'; import '../preview/preview_panel.dart'; @@ -40,20 +40,15 @@ class ColorInterpretationProperties extends ConsumerWidget { final detected = colors?.elementAtOrNull(trackIndex); final reported = colors != null && trackIndex >= 0 && trackIndex < colors.length; - final status = selected != null - ? context.l10n.manualColorSpace(selected.label(context.l10n)) - : detected != null - ? context.l10n.detectedColorSpace(detected.label(context.l10n)) - : reported + final notice = !reported + ? context.l10n.colorInfoNotLoaded + : selected == null && detected == null ? context.l10n.unknownColorSpace - : context.l10n.colorInfoNotLoaded; - final selector = AppSelect( - emptyLabel: context.l10n.noMatchingOptions, - key: const Key('media-color-menu'), - outlined: false, - label: context.l10n.mediaColorInterpretation, + : null; + return ColorInterpretationControls( value: selected?.name ?? 'auto', - onChanged: !reported + notice: notice, + onChanged: !reported || !session.acceptsEdits ? null : (value) => session.commands.setMediaColor( assetId, @@ -61,66 +56,16 @@ class ColorInterpretationProperties extends ConsumerWidget { value == 'auto' ? null : MediaColorSpace.values.byName(value), ), options: [ - AppSelectOption('auto', context.l10n.auto), + AppSelectOption( + 'auto', + detected == null + ? context.l10n.auto + : '${context.l10n.auto} · ${detected.label(context.l10n)}', + ), for (final color in RenderColorSpace.values) AppSelectOption(color.name, color.label(context.l10n)), ], ); - final controls = Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - spacing: AppSpacing.gap, - children: [ - if (AppTheme.isDesktop(context)) ...[ - AppPropertyGroup( - label: context.l10n.mediaColorSpace, - child: selector, - ), - ] else - Row( - children: [ - Expanded( - child: Text( - context.l10n.mediaColorSpace, - style: AppTheme.propertySectionTitleStyle(context), - ), - ), - Flexible(child: selector), - ], - ), - Text( - status, - key: const Key('media-color-status'), - style: Theme.of(context).textTheme.bodySmall, - ), - ], - ); - return AppPropertySection( - bottomSpacing: AppTheme.isDesktop(context) ? 0 : null, - child: AppTheme.isDesktop(context) - ? ExpansionTile( - key: PageStorageKey(( - 'media-color-section', - assetId, - trackIndex, - )), - title: Text( - context.l10n.mediaColorInterpretation, - style: AppTheme.propertySectionTitleStyle(context), - ), - tilePadding: EdgeInsets.zero, - childrenPadding: const EdgeInsets.only( - bottom: AppInspectorMetrics.groupGap, - ), - minTileHeight: AppInspectorMetrics.sectionHeader, - dense: true, - maintainState: true, - initiallyExpanded: selected != null, - shape: const Border(), - collapsedShape: const Border(), - children: [controls], - ) - : controls, - ); } return ListenableSelector( diff --git a/lib/features/properties/project_properties.dart b/lib/features/properties/project_properties.dart index f070304..29d196d 100644 --- a/lib/features/properties/project_properties.dart +++ b/lib/features/properties/project_properties.dart @@ -80,8 +80,8 @@ class ProjectProperties extends StatelessWidget { () => session.canvas.label(context), ), info( - context.l10n.projectColorSpace, - () => switch (session.projectColorSpace) { + context.l10n.projectOutputColorSpace, + () => switch (session.projectOutputColorSpace) { RenderColorSpace.rec2020HLG => 'HDR · Rec.2020 HLG', RenderColorSpace.rec2020PQ => 'HDR · Rec.2020 PQ', _ => 'SDR · Rec.709', diff --git a/lib/features/properties/project_settings_dialog.dart b/lib/features/properties/project_settings_dialog.dart index 6cea667..4a5e29c 100644 --- a/lib/features/properties/project_settings_dialog.dart +++ b/lib/features/properties/project_settings_dialog.dart @@ -56,7 +56,7 @@ class _ProjectSettingsDialogState extends State { .timeline(widget.session.activeSequenceId!) .format .frameDuration; - _color = widget.session.projectColorSpace; + _color = widget.session.projectOutputColorSpace; _preset = _sizes.entries .where((e) => e.value.$1 == canvas.width && e.value.$2 == canvas.height) .firstOrNull @@ -198,12 +198,12 @@ class _ProjectSettingsDialogState extends State { ), ), AppField( - label: l10n.projectColorSpace, + label: l10n.projectOutputColorSpace, child: AppSelect( emptyLabel: context.l10n.noMatchingOptions, key: const ValueKey('project-color-space'), value: _color, - label: l10n.projectColorSpace, + label: l10n.projectOutputColorSpace, options: const [ AppSelectOption(RenderColorSpace.rec709, 'SDR · Rec.709'), AppSelectOption( diff --git a/lib/features/properties/properties_content.dart b/lib/features/properties/properties_content.dart index 3769aea..4995777 100644 --- a/lib/features/properties/properties_content.dart +++ b/lib/features/properties/properties_content.dart @@ -146,26 +146,22 @@ class PropertiesContent extends ConsumerWidget { clip: clip, hasAudio: hasAudio, ), - picture: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - if (payload?.type == 'video' && binding?.videoTrackIndex != null) - ColorInterpretationProperties( + color: payload?.type == 'video' && binding?.videoTrackIndex != null + ? ColorInterpretationProperties( projectId: projectId, timelineId: timelineId, session: session, assetId: payload!.assetIds.single, trackIndex: binding!.videoTrackIndex!, - ), - PictureProperties( - key: ValueKey((sequence, clip.id)), - projectId: projectId, - timelineId: timelineId, - session: session, - sequence: sequence, - clip: clip, - ), - ], + ) + : const SizedBox.shrink(), + picture: PictureProperties( + key: ValueKey((sequence, clip.id)), + projectId: projectId, + timelineId: timelineId, + session: session, + sequence: sequence, + clip: clip, ), animation: PictureProperties( key: ValueKey((sequence, clip.id, 'animation')), @@ -189,6 +185,7 @@ class _ClipProperties extends StatefulWidget { required this.sequence, required this.clip, required this.picture, + required this.color, required this.mask, required this.audio, required this.speed, @@ -203,6 +200,7 @@ class _ClipProperties extends StatefulWidget { final SequenceId sequence; final ElementRecord clip; final Widget picture; + final Widget color; final Widget mask; final Widget audio; final Widget speed; @@ -266,6 +264,7 @@ class _ClipPropertiesState extends State<_ClipProperties> { children: [ ...switch (_selected) { PropertyCategory.picture => [widget.picture], + PropertyCategory.color => [widget.color], PropertyCategory.mask => [widget.mask], PropertyCategory.audio => [widget.audio], PropertyCategory.speed => [widget.speed], diff --git a/lib/features/properties/properties_inspector_controller.dart b/lib/features/properties/properties_inspector_controller.dart index 54ea935..b648b8c 100644 --- a/lib/features/properties/properties_inspector_controller.dart +++ b/lib/features/properties/properties_inspector_controller.dart @@ -125,6 +125,7 @@ List categoriesForClip(ElementRecord clip, String? type) { return switch (type) { 'video' => [ PropertyCategory.picture, + PropertyCategory.color, PropertyCategory.mask, PropertyCategory.audio, PropertyCategory.speed, diff --git a/lib/features/properties/properties_presentation_state.dart b/lib/features/properties/properties_presentation_state.dart index f598920..9a62799 100644 --- a/lib/features/properties/properties_presentation_state.dart +++ b/lib/features/properties/properties_presentation_state.dart @@ -14,6 +14,7 @@ final propertyCategoryProvider = enum PropertyCategory { picture, + color, mask, audio, speed, @@ -22,6 +23,7 @@ enum PropertyCategory { String label(BuildContext context) => switch (this) { picture => context.l10n.pictureProperties, + color => context.l10n.color, mask => context.l10n.mask, audio => context.l10n.audio, speed => context.l10n.speedChange, diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 5a69f8d..518dbbb 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -196,7 +196,9 @@ "invalidNumber": "Ungültiger Wert", "mediaUnavailable": "Medien nicht verfügbar", "mediaMissing": "Fehlende Medien", - "mediaColorSpace": "Medienfarbraum", + "mediaInputColorSpace": "Eingabefarbraum", + "resetMediaColorInterpretation": "Automatische Erkennung wiederherstellen", + "mediaColorInterpretationScope": "Gilt für alle Clips, die diesen Quellvideostream verwenden.", "mediaColorInterpretation": "Interpretation der Medienfarbe", "colorInfoNotLoaded": "Farbinformationen nicht geladen", "unknownColorSpace": "Unbekannter Farbraum. Anzeige als Rec.709.", @@ -613,7 +615,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "Ausgabefarbraum", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index a2206bf..9d4af97 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -261,7 +261,9 @@ "invalidNumber": "Invalid value", "mediaUnavailable": "Media unavailable", "mediaMissing": "Missing media", - "mediaColorSpace": "Media color space", + "mediaInputColorSpace": "Input color space", + "resetMediaColorInterpretation": "Restore automatic detection", + "mediaColorInterpretationScope": "Applies to all clips using this source video stream.", "mediaColorInterpretation": "Media color interpretation", "colorInfoNotLoaded": "Color information not loaded", "unknownColorSpace": "Unknown color space. Displaying as Rec.709.", @@ -678,7 +680,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "Output color space", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index fd8e5a1..eff469d 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -196,7 +196,9 @@ "invalidNumber": "Valor no válido", "mediaUnavailable": "Medios no disponibles", "mediaMissing": "Medios faltantes", - "mediaColorSpace": "Espacio de color de medios", + "mediaInputColorSpace": "Espacio de color de entrada", + "resetMediaColorInterpretation": "Restaurar detección automática", + "mediaColorInterpretationScope": "Se aplica a todos los clips que usan este flujo de video de origen.", "mediaColorInterpretation": "Interpretación del color de los medios.", "colorInfoNotLoaded": "Información de color no cargada", "unknownColorSpace": "Espacio de color desconocido. Mostrando como Rec.709.", @@ -613,7 +615,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "Espacio de color de salida", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index a422b4e..9d7f5dd 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -196,7 +196,9 @@ "invalidNumber": "Valeur invalide", "mediaUnavailable": "Médias indisponibles", "mediaMissing": "Média manquant", - "mediaColorSpace": "Espace colorimétrique des médias", + "mediaInputColorSpace": "Espace colorimétrique d’entrée", + "resetMediaColorInterpretation": "Rétablir la détection automatique", + "mediaColorInterpretationScope": "S’applique à tous les plans utilisant ce flux vidéo source.", "mediaColorInterpretation": "Interprétation des couleurs des médias", "colorInfoNotLoaded": "Les informations de couleur ne sont pas chargées", "unknownColorSpace": "Espace colorimétrique inconnu. Affichage sous forme de Rec.709.", @@ -613,7 +615,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "Espace colorimétrique de sortie", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 9ca15a0..8f6731a 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -196,7 +196,9 @@ "invalidNumber": "Valore non valido", "mediaUnavailable": "Supporto non disponibile", "mediaMissing": "Media mancanti", - "mediaColorSpace": "Spazio colore multimediale", + "mediaInputColorSpace": "Spazio colore di ingresso", + "resetMediaColorInterpretation": "Ripristina rilevamento automatico", + "mediaColorInterpretationScope": "Si applica a tutte le clip che usano questo flusso video sorgente.", "mediaColorInterpretation": "Interpretazione del colore dei media", "colorInfoNotLoaded": "Informazioni sul colore non caricate", "unknownColorSpace": "Spazio colore sconosciuto. Visualizzato come Rec.709.", @@ -613,7 +615,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "Spazio colore di uscita", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index c4033e6..335dfb4 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -196,7 +196,9 @@ "invalidNumber": "無効な値", "mediaUnavailable": "メディアが利用できません", "mediaMissing": "メディアが見つかりません", - "mediaColorSpace": "メディアの色空間", + "mediaInputColorSpace": "入力色空間", + "resetMediaColorInterpretation": "自動検出に戻す", + "mediaColorInterpretationScope": "この素材の映像ストリームを使用するすべてのクリップに適用されます。", "mediaColorInterpretation": "メディアの色の解釈", "colorInfoNotLoaded": "カラー情報が読み込まれていません", "unknownColorSpace": "不明な色空間。 Rec.709として表示されます。", @@ -613,7 +615,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "出力色空間", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index 3aca2d0..6fc68f1 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -196,7 +196,9 @@ "invalidNumber": "잘못된 값", "mediaUnavailable": "미디어를 사용할 수 없음", "mediaMissing": "미디어 누락", - "mediaColorSpace": "미디어 색 공간", + "mediaInputColorSpace": "입력 색 공간", + "resetMediaColorInterpretation": "자동 감지 복원", + "mediaColorInterpretationScope": "이 소스 비디오 스트림을 사용하는 모든 클립에 적용됩니다.", "mediaColorInterpretation": "미디어 색상 해석", "colorInfoNotLoaded": "색상 정보가 로드되지 않았습니다.", "unknownColorSpace": "알 수 없는 색상 공간입니다. Rec.709로 표시됩니다.", @@ -613,7 +615,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "출력 색 공간", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 0098d20..87089ad 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -1466,11 +1466,23 @@ abstract class AppLocalizations { /// **'Missing media'** String get mediaMissing; - /// No description provided for @mediaColorSpace. + /// No description provided for @mediaInputColorSpace. /// /// In en, this message translates to: - /// **'Media color space'** - String get mediaColorSpace; + /// **'Input color space'** + String get mediaInputColorSpace; + + /// No description provided for @resetMediaColorInterpretation. + /// + /// In en, this message translates to: + /// **'Restore automatic detection'** + String get resetMediaColorInterpretation; + + /// No description provided for @mediaColorInterpretationScope. + /// + /// In en, this message translates to: + /// **'Applies to all clips using this source video stream.'** + String get mediaColorInterpretationScope; /// No description provided for @mediaColorInterpretation. /// @@ -2630,11 +2642,11 @@ abstract class AppLocalizations { /// **'Change project output settings while keeping clip timing and speed.'** String get projectSettingsDescription; - /// No description provided for @projectColorSpace. + /// No description provided for @projectOutputColorSpace. /// /// In en, this message translates to: - /// **'Color space'** - String get projectColorSpace; + /// **'Output color space'** + String get projectOutputColorSpace; /// No description provided for @projectWidth. /// diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 6b4c594..a8ffbf9 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -727,7 +727,15 @@ class AppLocalizationsDe extends AppLocalizations { String get mediaMissing => 'Fehlende Medien'; @override - String get mediaColorSpace => 'Medienfarbraum'; + String get mediaInputColorSpace => 'Eingabefarbraum'; + + @override + String get resetMediaColorInterpretation => + 'Automatische Erkennung wiederherstellen'; + + @override + String get mediaColorInterpretationScope => + 'Gilt für alle Clips, die diesen Quellvideostream verwenden.'; @override String get mediaColorInterpretation => 'Interpretation der Medienfarbe'; @@ -1437,7 +1445,7 @@ class AppLocalizationsDe extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => 'Ausgabefarbraum'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 9c11d7c..33c4e00 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -720,7 +720,14 @@ class AppLocalizationsEn extends AppLocalizations { String get mediaMissing => 'Missing media'; @override - String get mediaColorSpace => 'Media color space'; + String get mediaInputColorSpace => 'Input color space'; + + @override + String get resetMediaColorInterpretation => 'Restore automatic detection'; + + @override + String get mediaColorInterpretationScope => + 'Applies to all clips using this source video stream.'; @override String get mediaColorInterpretation => 'Media color interpretation'; @@ -1410,7 +1417,7 @@ class AppLocalizationsEn extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => 'Output color space'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index a6c7374..fbf251c 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -727,7 +727,14 @@ class AppLocalizationsEs extends AppLocalizations { String get mediaMissing => 'Medios faltantes'; @override - String get mediaColorSpace => 'Espacio de color de medios'; + String get mediaInputColorSpace => 'Espacio de color de entrada'; + + @override + String get resetMediaColorInterpretation => 'Restaurar detección automática'; + + @override + String get mediaColorInterpretationScope => + 'Se aplica a todos los clips que usan este flujo de video de origen.'; @override String get mediaColorInterpretation => @@ -1436,7 +1443,7 @@ class AppLocalizationsEs extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => 'Espacio de color de salida'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 46ac799..5517e3d 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -724,7 +724,15 @@ class AppLocalizationsFr extends AppLocalizations { String get mediaMissing => 'Média manquant'; @override - String get mediaColorSpace => 'Espace colorimétrique des médias'; + String get mediaInputColorSpace => 'Espace colorimétrique d’entrée'; + + @override + String get resetMediaColorInterpretation => + 'Rétablir la détection automatique'; + + @override + String get mediaColorInterpretationScope => + 'S’applique à tous les plans utilisant ce flux vidéo source.'; @override String get mediaColorInterpretation => @@ -1434,7 +1442,7 @@ class AppLocalizationsFr extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => 'Espace colorimétrique de sortie'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 9862d97..5180bae 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -724,7 +724,15 @@ class AppLocalizationsIt extends AppLocalizations { String get mediaMissing => 'Media mancanti'; @override - String get mediaColorSpace => 'Spazio colore multimediale'; + String get mediaInputColorSpace => 'Spazio colore di ingresso'; + + @override + String get resetMediaColorInterpretation => + 'Ripristina rilevamento automatico'; + + @override + String get mediaColorInterpretationScope => + 'Si applica a tutte le clip che usano questo flusso video sorgente.'; @override String get mediaColorInterpretation => 'Interpretazione del colore dei media'; @@ -1430,7 +1438,7 @@ class AppLocalizationsIt extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => 'Spazio colore di uscita'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 7d6607e..0cd3dd1 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -701,7 +701,14 @@ class AppLocalizationsJa extends AppLocalizations { String get mediaMissing => 'メディアが見つかりません'; @override - String get mediaColorSpace => 'メディアの色空間'; + String get mediaInputColorSpace => '入力色空間'; + + @override + String get resetMediaColorInterpretation => '自動検出に戻す'; + + @override + String get mediaColorInterpretationScope => + 'この素材の映像ストリームを使用するすべてのクリップに適用されます。'; @override String get mediaColorInterpretation => 'メディアの色の解釈'; @@ -1368,7 +1375,7 @@ class AppLocalizationsJa extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => '出力色空間'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 5799851..a31c5f1 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -702,7 +702,14 @@ class AppLocalizationsKo extends AppLocalizations { String get mediaMissing => '미디어 누락'; @override - String get mediaColorSpace => '미디어 색 공간'; + String get mediaInputColorSpace => '입력 색 공간'; + + @override + String get resetMediaColorInterpretation => '자동 감지 복원'; + + @override + String get mediaColorInterpretationScope => + '이 소스 비디오 스트림을 사용하는 모든 클립에 적용됩니다.'; @override String get mediaColorInterpretation => '미디어 색상 해석'; @@ -1367,7 +1374,7 @@ class AppLocalizationsKo extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => '출력 색 공간'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 0966505..cfdb8c0 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -725,7 +725,14 @@ class AppLocalizationsPt extends AppLocalizations { String get mediaMissing => 'Mídia ausente'; @override - String get mediaColorSpace => 'Espaço de cores da mídia'; + String get mediaInputColorSpace => 'Espaço de cor de entrada'; + + @override + String get resetMediaColorInterpretation => 'Restaurar detecção automática'; + + @override + String get mediaColorInterpretationScope => + 'Aplica-se a todos os clipes que usam este fluxo de vídeo de origem.'; @override String get mediaColorInterpretation => 'Interpretação de cores da mídia'; @@ -1431,7 +1438,7 @@ class AppLocalizationsPt extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => 'Espaço de cor de saída'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index bc78494..f3eebcf 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -721,7 +721,15 @@ class AppLocalizationsRu extends AppLocalizations { String get mediaMissing => 'Медиа отсутствует'; @override - String get mediaColorSpace => 'Цветовое пространство мультимедиа'; + String get mediaInputColorSpace => 'Входное цветовое пространство'; + + @override + String get resetMediaColorInterpretation => + 'Восстановить автоматическое определение'; + + @override + String get mediaColorInterpretationScope => + 'Применяется ко всем клипам, использующим этот исходный видеопоток.'; @override String get mediaColorInterpretation => 'Интерпретация цвета медиа'; @@ -1426,7 +1434,7 @@ class AppLocalizationsRu extends AppLocalizations { 'Change project output settings while keeping clip timing and speed.'; @override - String get projectColorSpace => 'Color space'; + String get projectOutputColorSpace => 'Выходное цветовое пространство'; @override String get projectWidth => 'Width (px)'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index c446c29..9d38d91 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -695,7 +695,13 @@ class AppLocalizationsZh extends AppLocalizations { String get mediaMissing => '素材缺失'; @override - String get mediaColorSpace => '素材色彩空间'; + String get mediaInputColorSpace => '输入色彩空间'; + + @override + String get resetMediaColorInterpretation => '恢复自动识别'; + + @override + String get mediaColorInterpretationScope => '影响使用该素材视频流的所有片段。'; @override String get mediaColorInterpretation => '素材色彩解释'; @@ -1339,7 +1345,7 @@ class AppLocalizationsZh extends AppLocalizations { String get projectSettingsDescription => '修改项目输出规格,保留片段的实际时长和速度。'; @override - String get projectColorSpace => '色彩空间'; + String get projectOutputColorSpace => '输出色彩空间'; @override String get projectWidth => '宽度(px)'; @@ -3128,7 +3134,13 @@ class AppLocalizationsZhHans extends AppLocalizationsZh { String get mediaMissing => '素材缺失'; @override - String get mediaColorSpace => '素材色彩空间'; + String get mediaInputColorSpace => '输入色彩空间'; + + @override + String get resetMediaColorInterpretation => '恢复自动识别'; + + @override + String get mediaColorInterpretationScope => '影响使用该素材视频流的所有片段。'; @override String get mediaColorInterpretation => '素材色彩解释'; @@ -3772,7 +3784,7 @@ class AppLocalizationsZhHans extends AppLocalizationsZh { String get projectSettingsDescription => '修改项目输出规格,保留片段的实际时长和速度。'; @override - String get projectColorSpace => '色彩空间'; + String get projectOutputColorSpace => '输出色彩空间'; @override String get projectWidth => '宽度(px)'; @@ -5561,7 +5573,13 @@ class AppLocalizationsZhHant extends AppLocalizationsZh { String get mediaMissing => '素材缺失'; @override - String get mediaColorSpace => '素材色彩空間'; + String get mediaInputColorSpace => '輸入色彩空間'; + + @override + String get resetMediaColorInterpretation => '恢復自動辨識'; + + @override + String get mediaColorInterpretationScope => '影響使用此素材視訊串流的所有片段。'; @override String get mediaColorInterpretation => '素材色彩解釋'; @@ -6205,7 +6223,7 @@ class AppLocalizationsZhHant extends AppLocalizationsZh { String get projectSettingsDescription => '修改项目输出规格,保留片段的实际时长和速度。'; @override - String get projectColorSpace => '色彩空间'; + String get projectOutputColorSpace => '輸出色彩空間'; @override String get projectWidth => '宽度(px)'; diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 1311452..49aa3d0 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -196,7 +196,9 @@ "invalidNumber": "Valor inválido", "mediaUnavailable": "Mídia indisponível", "mediaMissing": "Mídia ausente", - "mediaColorSpace": "Espaço de cores da mídia", + "mediaInputColorSpace": "Espaço de cor de entrada", + "resetMediaColorInterpretation": "Restaurar detecção automática", + "mediaColorInterpretationScope": "Aplica-se a todos os clipes que usam este fluxo de vídeo de origem.", "mediaColorInterpretation": "Interpretação de cores da mídia", "colorInfoNotLoaded": "Informações de cor não carregadas", "unknownColorSpace": "Espaço de cores desconhecido. Exibindo como Rec.709.", @@ -613,7 +615,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "Espaço de cor de saída", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 471de30..032a449 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -196,7 +196,9 @@ "invalidNumber": "Недопустимое значение", "mediaUnavailable": "Медиа недоступно", "mediaMissing": "Медиа отсутствует", - "mediaColorSpace": "Цветовое пространство мультимедиа", + "mediaInputColorSpace": "Входное цветовое пространство", + "resetMediaColorInterpretation": "Восстановить автоматическое определение", + "mediaColorInterpretationScope": "Применяется ко всем клипам, использующим этот исходный видеопоток.", "mediaColorInterpretation": "Интерпретация цвета медиа", "colorInfoNotLoaded": "Информация о цвете не загружена", "unknownColorSpace": "Неизвестное цветовое пространство. Отображается как Rec.709.", @@ -613,7 +615,7 @@ "modify": "Modify", "projectSettings": "Project settings", "projectSettingsDescription": "Change project output settings while keeping clip timing and speed.", - "projectColorSpace": "Color space", + "projectOutputColorSpace": "Выходное цветовое пространство", "projectWidth": "Width (px)", "projectHeight": "Height (px)", "projectResolutionInvalid": "Enter a whole number from 1 to 16384", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 7e5ff7c..1e99f62 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -225,7 +225,9 @@ "invalidNumber": "无效数值", "mediaUnavailable": "素材不可用", "mediaMissing": "素材缺失", - "mediaColorSpace": "素材色彩空间", + "mediaInputColorSpace": "输入色彩空间", + "resetMediaColorInterpretation": "恢复自动识别", + "mediaColorInterpretationScope": "影响使用该素材视频流的所有片段。", "mediaColorInterpretation": "素材色彩解释", "colorInfoNotLoaded": "色彩信息未读取", "unknownColorSpace": "色彩空间未知,暂按 Rec.709 显示", @@ -642,7 +644,7 @@ "modify": "修改", "projectSettings": "项目设置", "projectSettingsDescription": "修改项目输出规格,保留片段的实际时长和速度。", - "projectColorSpace": "色彩空间", + "projectOutputColorSpace": "输出色彩空间", "projectWidth": "宽度(px)", "projectHeight": "高度(px)", "projectResolutionInvalid": "请输入 1–16384 的整数", diff --git a/lib/l10n/app_zh_Hans.arb b/lib/l10n/app_zh_Hans.arb index be47e1f..6d75aaf 100644 --- a/lib/l10n/app_zh_Hans.arb +++ b/lib/l10n/app_zh_Hans.arb @@ -225,7 +225,9 @@ "invalidNumber": "无效数值", "mediaUnavailable": "素材不可用", "mediaMissing": "素材缺失", - "mediaColorSpace": "素材色彩空间", + "mediaInputColorSpace": "输入色彩空间", + "resetMediaColorInterpretation": "恢复自动识别", + "mediaColorInterpretationScope": "影响使用该素材视频流的所有片段。", "mediaColorInterpretation": "素材色彩解释", "colorInfoNotLoaded": "色彩信息未读取", "unknownColorSpace": "色彩空间未知,暂按 Rec.709 显示", @@ -642,7 +644,7 @@ "modify": "修改", "projectSettings": "项目设置", "projectSettingsDescription": "修改项目输出规格,保留片段的实际时长和速度。", - "projectColorSpace": "色彩空间", + "projectOutputColorSpace": "输出色彩空间", "projectWidth": "宽度(px)", "projectHeight": "高度(px)", "projectResolutionInvalid": "请输入 1–16384 的整数", diff --git a/lib/l10n/app_zh_Hant.arb b/lib/l10n/app_zh_Hant.arb index 5a4c65c..3001900 100644 --- a/lib/l10n/app_zh_Hant.arb +++ b/lib/l10n/app_zh_Hant.arb @@ -225,7 +225,9 @@ "invalidNumber": "無效數值", "mediaUnavailable": "素材不可用", "mediaMissing": "素材缺失", - "mediaColorSpace": "素材色彩空間", + "mediaInputColorSpace": "輸入色彩空間", + "resetMediaColorInterpretation": "恢復自動辨識", + "mediaColorInterpretationScope": "影響使用此素材視訊串流的所有片段。", "mediaColorInterpretation": "素材色彩解釋", "colorInfoNotLoaded": "色彩資訊未讀取", "unknownColorSpace": "色彩空間未知,暫按 Rec.709 顯示", @@ -642,7 +644,7 @@ "modify": "修改", "projectSettings": "项目设置", "projectSettingsDescription": "修改项目输出规格,保留片段的实际时长和速度。", - "projectColorSpace": "色彩空间", + "projectOutputColorSpace": "輸出色彩空間", "projectWidth": "宽度(px)", "projectHeight": "高度(px)", "projectResolutionInvalid": "请输入 1–16384 的整数", diff --git a/lib/workspace/media_color_interpretation.dart b/lib/workspace/media_color_interpretation.dart index 8f9878f..e6c51e4 100644 --- a/lib/workspace/media_color_interpretation.dart +++ b/lib/workspace/media_color_interpretation.dart @@ -20,4 +20,6 @@ RenderColorSpace? resolveMediaColor({ required bool metadataReported, }) => override ?? - (metadataReported && detected == null ? RenderColorSpace.rec709 : null); + (metadataReported && detected == null + ? RenderColorPolicy.defaultUnknownVideoColorSpace + : null); diff --git a/test/media_color_interpretation_test.dart b/test/media_color_interpretation_test.dart index 9a64458..a0bf087 100644 --- a/test/media_color_interpretation_test.dart +++ b/test/media_color_interpretation_test.dart @@ -8,6 +8,7 @@ import 'package:cutdex/workspace/timeline_session.dart'; import 'package:cutdex_sdk/runtime.dart'; import 'package:flutter/material.dart'; import 'package:cutdex_ui/theme.dart'; +import 'package:cutdex_ui/widgets.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -21,8 +22,10 @@ class _ColorPreview extends PreviewController { activeSequence: () => timeline.activeSequenceId, viewForSequence: timeline.view, ); + List? colors = [null]; + @override - List? videoColorSpaces(String assetId) => [null]; + List? videoColorSpaces(String assetId) => colors; } void main() { @@ -107,12 +110,17 @@ void main() { ), ); await tester.pumpAndSettle(); - if (desktop) { - expect(find.byKey(const Key('media-color-menu')), findsNothing); - await tester.tap(find.byType(ExpansionTile)); - await tester.pumpAndSettle(); - } + expect(find.byType(ExpansionTile), findsNothing); + expect( + tester + .widget( + find.byKey(const Key('media-color-reset')), + ) + .onPressed, + isNull, + ); expect(find.text('色彩空间未知,暂按 Rec.709 显示'), findsOneWidget); + expect(find.byTooltip('影响使用该素材视频流的所有片段。'), findsOneWidget); expect( f.timeline.settings.containsKey('mediaColorInterpretations'), isFalse, @@ -121,13 +129,8 @@ void main() { await tester.pumpAndSettle(); await tester.tap(find.text('线性 Rec.2020')); await tester.pumpAndSettle(); - if (desktop) { - await tester.tap(find.byType(ExpansionTile)); - await tester.pumpAndSettle(); - await tester.tap(find.byType(ExpansionTile)); - await tester.pumpAndSettle(); - } - expect(find.text('手动指定:线性 Rec.2020'), findsOneWidget); + expect(find.text('线性 Rec.2020'), findsOneWidget); + expect(find.byKey(const Key('media-color-status')), findsNothing); expect(tester.takeException(), isNull); { await f.timeline.flush(); @@ -143,12 +146,43 @@ void main() { ); expect(reopened.mediaColorInterpretation('media', 1), isNull); } - await tester.tap(find.byKey(const Key('media-color-menu'))); - await tester.pumpAndSettle(); - await tester.tap(find.text('自动')); - await tester.pumpAndSettle(); + if (desktop) { + await tester.tap(find.byKey(const Key('media-color-reset'))); + await tester.pumpAndSettle(); + } else { + await tester.tap(find.byKey(const Key('media-color-menu'))); + await tester.pumpAndSettle(); + await tester.tap(find.text('自动')); + await tester.pumpAndSettle(); + } expect(find.text('色彩空间未知,暂按 Rec.709 显示'), findsOneWidget); expect(f.timeline.mediaColorInterpretation('media', 0), isNull); + preview.colors = null; + preview.notifyListeners(); + await tester.pumpAndSettle(); + expect(find.text('色彩信息未读取'), findsOneWidget); + expect( + tester + .widget>( + find.byKey(const Key('media-color-menu')), + ) + .onChanged, + isNull, + ); + preview.colors = [RenderColorSpace.rec2020HLG]; + preview.notifyListeners(); + await tester.pumpAndSettle(); + expect(find.text('自动 · Rec.2020 HLG'), findsOneWidget); + expect(find.byKey(const Key('media-color-status')), findsNothing); + expect( + tester + .widget>( + find.byKey(const Key('media-color-menu')), + ) + .onChanged, + isNotNull, + ); + expect(tester.takeException(), isNull); }); }, diff --git a/test/project_properties_test.dart b/test/project_properties_test.dart index 5351624..a5dd8b3 100644 --- a/test/project_properties_test.dart +++ b/test/project_properties_test.dart @@ -306,7 +306,7 @@ void main() { expect(find.text('项目设置'), findsNothing); expect(find.text('3840 × 2160 px'), findsOneWidget); expect(find.text('29.97 fps'), findsOneWidget); - expect(f.timeline.projectColorSpace, RenderColorSpace.rec2020PQ); + expect(f.timeline.projectOutputColorSpace, RenderColorSpace.rec2020PQ); expect( f.timeline.view(SequenceId('one')).format.frameDuration, RationalTime(1001, 30000), @@ -316,7 +316,7 @@ void main() { await tester.pumpAndSettle(); expect(find.text('1080 × 1920 px'), findsOneWidget); expect(find.text('30 fps'), findsOneWidget); - expect(f.timeline.projectColorSpace, RenderColorSpace.rec709); + expect(f.timeline.projectOutputColorSpace, RenderColorSpace.rec709); await tester.tap(find.byKey(const ValueKey('project-settings-edit'))); await tester.pumpAndSettle(); await tester.enterText(find.byKey(const ValueKey('project-width')), '1280'); diff --git a/test/properties_scroll_state_test.dart b/test/properties_scroll_state_test.dart index 5faa4d3..7441e7e 100644 --- a/test/properties_scroll_state_test.dart +++ b/test/properties_scroll_state_test.dart @@ -12,7 +12,7 @@ import 'support/preview_fixture.dart'; void main() { testWidgets( - 'property categories restore scroll and expansion independently', + 'property categories restore scroll independently and keep color controls visible', (tester) async { final f = (await tester.runAsync( () => createPreviewFixture(Uri.file('/test/video.mov'), hasAudio: true), @@ -76,7 +76,7 @@ void main() { await tester.pumpAndSettle(); expect(tester.takeException(), isNull); expect(find.byKey(const Key('media-color-menu')), findsNothing); - await tester.tap(find.text('素材色彩解释')); + await tester.tap(find.byKey(const ValueKey('property-tab-color'))); await tester.pumpAndSettle(); expect(find.byKey(const Key('media-color-menu')), findsOneWidget); @@ -84,7 +84,7 @@ void main() { await tester.tap(find.byKey(const ValueKey('property-tab-audio'))); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); - await tester.tap(find.byKey(const ValueKey('property-tab-picture'))); + await tester.tap(find.byKey(const ValueKey('property-tab-color'))); await tester.pumpAndSettle(); expect(tester.takeException(), isNull); } @@ -106,19 +106,27 @@ void main() { await switchBack(); expect(find.byKey(const Key('media-color-menu')), findsOneWidget); + await tester.tap(find.byKey(const ValueKey('property-tab-picture'))); + await tester.pumpAndSettle(); + expect(find.byKey(const Key('media-color-menu')), findsNothing); + expect(find.text('素材色彩解释'), findsNothing); position().jumpTo(55); await tester.pumpAndSettle(); expect(position().pixels, 55); - await switchBack(); - expect(position().pixels, 55); + await tester.tap(find.byKey(const ValueKey('property-tab-color'))); + await tester.pumpAndSettle(); + expect(position().pixels, 0); expect(find.byKey(const Key('media-color-menu')), findsOneWidget); + await tester.tap(find.byKey(const ValueKey('property-tab-picture'))); + await tester.pumpAndSettle(); + expect(position().pixels, 55); + await tester.tap(find.byKey(const ValueKey('property-tab-color'))); + await tester.pumpAndSettle(); position().jumpTo(0); await tester.pumpAndSettle(); - await tester.tap(find.text('素材色彩解释')); - await tester.pumpAndSettle(); await switchBack(); - expect(find.byKey(const Key('media-color-menu')), findsNothing); + expect(find.byKey(const Key('media-color-menu')), findsOneWidget); expect(position().pixels, 0); await tester.pumpWidget(const SizedBox()); },