Files
Forge/test/window_theme_style_test.dart

45 lines
1.9 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:forge/src/services/app_settings_service.dart';
import 'package:forge/src/ui/theme/window_theme_style.dart';
void main() {
group('WindowThemeStyle Tests', () {
test('Palettes and properties have correct values', () {
expect(WindowThemeStyle.macos.primaryColor, const Color(0xFF0A84FF));
expect(WindowThemeStyle.gnome.primaryColor, const Color(0xFF3584E4));
expect(WindowThemeStyle.kde.primaryColor, const Color(0xFF3DAEE9));
expect(WindowThemeStyle.kde.displayName, contains('KDE Plasma'));
expect(WindowThemeStyle.gnome.displayName, contains('GNOME'));
expect(WindowThemeStyle.macos.displayName, contains('macOS'));
final kdeTheme = WindowThemeStyle.kde.buildThemeData();
expect(kdeTheme.primaryColor, const Color(0xFF3DAEE9));
expect(kdeTheme.canvasColor, const Color(0xFF232629));
expect(kdeTheme.dividerColor, const Color(0xFF4D5358));
});
test('AppSettingsService theme switching', () async {
final service = AppSettingsService.instance;
await service.setWindowTheme('macos');
expect(service.windowTheme, 'macos');
expect(service.effectiveWindowThemeStyle, WindowThemeStyle.macos);
await service.setWindowTheme('gnome');
expect(service.windowTheme, 'gnome');
expect(service.effectiveWindowThemeStyle, WindowThemeStyle.gnome);
await service.setWindowTheme('kde');
expect(service.windowTheme, 'kde');
expect(service.effectiveWindowThemeStyle, WindowThemeStyle.kde);
await service.setWindowTheme('auto');
expect(service.windowTheme, 'auto');
// On host machine or test environment, effective should match detectDesktopEnvironmentStyle()
expect(service.effectiveWindowThemeStyle, AppSettingsService.detectDesktopEnvironmentStyle());
});
});
}