feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
This commit was merged in pull request #13.
This commit is contained in:
1 parent
aa5255d1e4
commit
abc1868550
260 files changed
+43964
-5591
No files matched your search
@@ -0,0 +1,112 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex/app/editor_theme.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
for (final palette in AppPalette.values) {
|
||||
for (final brightness in Brightness.values) {
|
||||
test(
|
||||
'${palette.name} ${brightness.name} shares semantic colors and readable text',
|
||||
() {
|
||||
final theme = EditorTheme.forPalette(palette, brightness);
|
||||
final colors = theme.colorScheme;
|
||||
final tokens = AppColors.of(theme);
|
||||
expect(theme.brightness, brightness);
|
||||
expect(tokens.family, palette);
|
||||
final settings = AppTheme.settingsContentTheme(theme);
|
||||
final dialog = AppTheme.dialogContentTheme(theme);
|
||||
final inspector = AppTheme.propertiesPanelTheme(theme);
|
||||
final actions = AppTheme.dialogActionTheme(theme);
|
||||
final timeline = theme.extension<TimelineThemeData>()!;
|
||||
expect(
|
||||
settings.switchTheme.trackColor!.resolve({WidgetState.selected}),
|
||||
colors.primary,
|
||||
);
|
||||
expect(
|
||||
(dialog.inputDecorationTheme.focusedBorder as OutlineInputBorder)
|
||||
.borderSide
|
||||
.color,
|
||||
colors.primary,
|
||||
);
|
||||
expect(timeline.selectionOutlineColor, colors.primary);
|
||||
expect(
|
||||
(inspector.inputDecorationTheme.focusedBorder as OutlineInputBorder)
|
||||
.borderSide
|
||||
.color,
|
||||
colors.primary,
|
||||
);
|
||||
for (final style in [
|
||||
theme.filledButtonTheme.style!,
|
||||
settings.filledButtonTheme.style!,
|
||||
actions.filledButtonTheme.style!,
|
||||
]) {
|
||||
final background = style.backgroundColor!.resolve({})!;
|
||||
final foreground = style.foregroundColor!.resolve({})!;
|
||||
expect(background, colors.primary);
|
||||
expect(
|
||||
_contrast(foreground, background),
|
||||
greaterThanOrEqualTo(4.5),
|
||||
);
|
||||
}
|
||||
expect(timeline.backgroundColor, colors.surface);
|
||||
expect(settings.colorScheme.surfaceContainer, tokens.card);
|
||||
expect(settings.inputDecorationTheme.fillColor, tokens.card);
|
||||
expect(inspector.inputDecorationTheme.fillColor, tokens.card);
|
||||
expect(AppColors.of(settings), tokens);
|
||||
expect(
|
||||
theme.extension<AppSurfaces>()!.previewBackground,
|
||||
Colors.black,
|
||||
);
|
||||
for (final surface in [
|
||||
colors.surface,
|
||||
colors.surfaceContainerLow,
|
||||
colors.surfaceContainer,
|
||||
timeline.visualClipColor,
|
||||
timeline.audioClipColor,
|
||||
]) {
|
||||
expect(
|
||||
_contrast(colors.onSurface, surface),
|
||||
greaterThanOrEqualTo(4.5),
|
||||
);
|
||||
}
|
||||
for (final surface in [
|
||||
colors.surface,
|
||||
colors.surfaceContainerLow,
|
||||
colors.surfaceContainer,
|
||||
]) {
|
||||
expect(
|
||||
_contrast(colors.onSurfaceVariant, surface),
|
||||
greaterThanOrEqualTo(4.5),
|
||||
);
|
||||
}
|
||||
expect(
|
||||
_contrast(colors.onPrimary, colors.primary),
|
||||
greaterThanOrEqualTo(4.5),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
test('six theme combinations have distinct workspace colors', () {
|
||||
final signatures = {
|
||||
for (final palette in AppPalette.values)
|
||||
for (final brightness in Brightness.values)
|
||||
(
|
||||
EditorTheme.forPalette(palette, brightness).colorScheme.surface,
|
||||
EditorTheme.forPalette(palette, brightness).colorScheme.primary,
|
||||
),
|
||||
};
|
||||
expect(signatures.length, 6);
|
||||
});
|
||||
}
|
||||
|
||||
double _contrast(Color a, Color b) {
|
||||
final first = a.computeLuminance();
|
||||
final second = b.computeLuminance();
|
||||
return (math.max(first, second) + .05) / (math.min(first, second) + .05);
|
||||
}
|
||||
Reference in new issue
Block a user