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
128 lines
5.2 KiB
Dart
128 lines
5.2 KiB
Dart
import 'dart:math' as math;
|
|
|
|
import 'package:cutdex/app/editor_theme.dart';
|
|
import 'package:cutdex_ui/theme.dart';
|
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test('desktop timecode ruler has room for labels and downward marks', () {
|
|
for (final palette in AppPalette.values) {
|
|
for (final brightness in Brightness.values) {
|
|
final mobile = EditorTheme.forPalette(palette, brightness);
|
|
final desktop = EditorTheme.desktop(mobile);
|
|
final ruler = desktop.extension<TimelineThemeData>()!;
|
|
expect(ruler.rulerHeight, 28);
|
|
expect(ruler.rulerTextStyle.fontSize, 12);
|
|
expect(
|
|
ruler.rulerTextStyle.fontFeatures,
|
|
contains(const FontFeature.tabularFigures()),
|
|
);
|
|
expect(ruler.playheadColor, desktop.colorScheme.primary);
|
|
expect(mobile.extension<TimelineThemeData>()!.rulerHeight, 20);
|
|
expect(
|
|
mobile.extension<TimelineThemeData>()!.playheadColor,
|
|
mobile.colorScheme.onSurface,
|
|
);
|
|
}
|
|
}
|
|
});
|
|
|
|
test(
|
|
'Pen presets give timeline the same Codex surface and ink hierarchy',
|
|
() {
|
|
final light = EditorTheme.penLight;
|
|
final dark = EditorTheme.penDark;
|
|
expect(light.colorScheme.surface, const Color(0xFFF6F6F6));
|
|
expect(light.colorScheme.surfaceContainerLow, const Color(0xFFFAFAFA));
|
|
expect(light.colorScheme.onSurface, const Color(0xFF020202));
|
|
expect(light.colorScheme.onSurfaceVariant, const Color(0xFF71717A));
|
|
expect(dark.colorScheme.surface, const Color(0xFF111111));
|
|
expect(dark.colorScheme.surfaceContainerLow, const Color(0xFF151515));
|
|
expect(dark.colorScheme.onSurface, const Color(0xFFFCFCFC));
|
|
expect(dark.colorScheme.outline, const Color(0xFF3B82F6));
|
|
expect(dark.dividerColor, const Color(0xFF303030));
|
|
expect(dark.dividerTheme.color, dark.dividerColor);
|
|
expect(light.dividerColor, light.colorScheme.outlineVariant);
|
|
expect(dark.colorScheme.outlineVariant, isNot(dark.dividerColor));
|
|
|
|
final inspector = AppTheme.propertiesPanelTheme(dark);
|
|
expect(inspector.colorScheme.surface, const Color(0xFF151515));
|
|
expect(inspector.textTheme.bodyMedium?.fontSize, 13);
|
|
expect(inspector.textTheme.labelLarge?.fontSize, 13);
|
|
expect(inspector.textTheme.labelMedium?.fontSize, 12);
|
|
expect(inspector.textTheme.labelSmall?.fontSize, 12);
|
|
|
|
final timeline = dark.extension<TimelineThemeData>()!;
|
|
expect(timeline.backgroundColor, dark.colorScheme.surface);
|
|
expect(
|
|
timeline.primaryLaneBackgroundColor,
|
|
dark.colorScheme.surfaceContainerLow,
|
|
);
|
|
expect(timeline.rulerBackgroundColor, dark.colorScheme.surface);
|
|
expect(timeline.rulerHeight, 20);
|
|
expect(timeline.clipBorderColor, const Color(0xFF303030));
|
|
expect(timeline.gapColor, const Color(0xFF303030));
|
|
expect(timeline.clipBorderWidth, 1);
|
|
expect(timeline.visualClipColor, const Color(0xFF2F2F2F));
|
|
expect(timeline.audioClipColor, const Color(0xFF242424));
|
|
expect(timeline.connectionLineColor, const Color(0xFF303030));
|
|
expect(timeline.connectionLineWidth, 3);
|
|
expect(timeline.selectionOutlineColor, dark.colorScheme.onSurface);
|
|
expect(timeline.selectionOutlineWidth, 2);
|
|
expect(timeline.clipCornerRadius, 4);
|
|
expect(timeline.clipNameTextStyle.color, dark.colorScheme.onSurface);
|
|
expect(timeline.rulerTextStyle.color, dark.colorScheme.onSurfaceVariant);
|
|
expect(timeline.playheadColor, dark.colorScheme.onSurface);
|
|
expect(AppTheme.timelinePanelTheme(dark).dividerColor, dark.dividerColor);
|
|
final lightTimeline = light.extension<TimelineThemeData>()!;
|
|
expect(lightTimeline.backgroundColor, light.colorScheme.surface);
|
|
expect(
|
|
lightTimeline.clipNameTextStyle.color,
|
|
light.colorScheme.onSurface,
|
|
);
|
|
expect(lightTimeline.clipBorderColor, light.colorScheme.outlineVariant);
|
|
expect(
|
|
timeline.scrollbarThumbColor,
|
|
const Color(0xFFFCFCFC).withValues(alpha: .084),
|
|
);
|
|
},
|
|
);
|
|
|
|
test('Neutral text and timeline labels remain legible in both modes', () {
|
|
for (final theme in [EditorTheme.penLight, EditorTheme.penDark]) {
|
|
final colors = theme.colorScheme;
|
|
expect(
|
|
_contrast(colors.onSurface, colors.surface),
|
|
greaterThanOrEqualTo(7),
|
|
);
|
|
if (colors.surface != const Color(0xFFF6F6F6)) {
|
|
for (final surface in [colors.surface, colors.surfaceContainerLow]) {
|
|
expect(
|
|
_contrast(colors.onSurfaceVariant, surface),
|
|
greaterThanOrEqualTo(4.5),
|
|
);
|
|
}
|
|
}
|
|
expect(
|
|
_contrast(colors.onPrimary, colors.primary),
|
|
greaterThanOrEqualTo(7),
|
|
);
|
|
final timeline = theme.extension<TimelineThemeData>()!;
|
|
for (final color in [timeline.visualClipColor, timeline.audioClipColor]) {
|
|
expect(
|
|
_contrast(timeline.clipNameTextStyle.color!, color),
|
|
greaterThanOrEqualTo(4.5),
|
|
);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
double _contrast(Color first, Color second) {
|
|
final a = first.computeLuminance();
|
|
final b = second.computeLuminance();
|
|
return (math.max(a, b) + .05) / (math.min(a, b) + .05);
|
|
}
|