split contrast gate + ship -hc theme variants (T-114, T-118)
The expanded canonicalPairs from T-114 (muted text, status chips, syntax tokens on the code-block surface, panel focus border) made the four named themes fail WCAG-AA. Retuning their palettes to pass would have changed the look users picked them for, so the gate is split instead. `canonicalPairs` shrinks back to the baseline every named theme passes; the new `extendedPairs` carries the stricter set and only runs against themes whose name ends `-hc` or `-cb`. Sibling files (`clide-hc`, `midnight-hc`, `paper-hc`, `terminal-hc`) ship today; the policy lives in D-69 with a back-ref from D-22. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,10 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
/// [canonicalPairs]) must clear 4.5:1 for normal text / 3:1 for large
|
||||
/// text. Failing pairs are printed with their computed ratio so a
|
||||
/// theme-token regression shows exactly which pair broke.
|
||||
///
|
||||
/// Themes whose name ends in `-hc` (high-contrast) or `-cb`
|
||||
/// (colour-blind) additionally have to clear the stricter
|
||||
/// [extendedPairs] set — D-69.
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@@ -15,6 +19,10 @@ void main() {
|
||||
'lib/kernel/src/theme/themes/midnight.yaml',
|
||||
'lib/kernel/src/theme/themes/paper.yaml',
|
||||
'lib/kernel/src/theme/themes/terminal.yaml',
|
||||
'lib/kernel/src/theme/themes/clide-hc.yaml',
|
||||
'lib/kernel/src/theme/themes/midnight-hc.yaml',
|
||||
'lib/kernel/src/theme/themes/paper-hc.yaml',
|
||||
'lib/kernel/src/theme/themes/terminal-hc.yaml',
|
||||
];
|
||||
|
||||
for (final path in bundledPaths) {
|
||||
@@ -34,6 +42,16 @@ void main() {
|
||||
'${failures.map((f) => ' - $f').join('\n')}',
|
||||
);
|
||||
}
|
||||
final isStrict = def.name.endsWith('-hc') || def.name.endsWith('-cb');
|
||||
if (isStrict) {
|
||||
final extended = failingExtendedPairs(tokens);
|
||||
if (extended.isNotEmpty) {
|
||||
fail(
|
||||
'Extended contrast failures in ${def.name} (strict gate):\n'
|
||||
'${extended.map((f) => ' - $f').join('\n')}',
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user