Files
network-app-mobile/test/config/theme_test.dart

90 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:network_app/config/theme.dart';
void main() {
group('AppTheme', () {
test('light theme uses Material 3', () {
final theme = AppTheme.light;
expect(theme.useMaterial3, isTrue);
});
test('dark theme uses Material 3', () {
final theme = AppTheme.dark;
expect(theme.useMaterial3, isTrue);
});
test('light theme has light brightness', () {
final theme = AppTheme.light;
expect(theme.colorScheme.brightness, Brightness.light);
});
test('dark theme has dark brightness', () {
final theme = AppTheme.dark;
expect(theme.colorScheme.brightness, Brightness.dark);
});
test('app bar is centered', () {
final theme = AppTheme.light;
expect(theme.appBarTheme.centerTitle, isTrue);
});
test('app bar has no elevation', () {
final theme = AppTheme.light;
expect(theme.appBarTheme.elevation, 0);
});
});
group('Color Constants', () {
test('primary color is defined', () {
const primaryColor = Color(0xFF2563EB);
expect(primaryColor.value, 0xFF2563EB);
});
test('primary color is blue', () {
const primaryColor = Color(0xFF2563EB);
expect(primaryColor.blue, greaterThan(200));
});
});
group('Input Decoration', () {
test('inputs are filled', () {
final theme = AppTheme.light;
expect(theme.inputDecorationTheme.filled, isTrue);
});
test('border radius is 12', () {
final theme = AppTheme.light;
final border = theme.inputDecorationTheme.border as OutlineInputBorder?;
expect(border?.borderRadius, BorderRadius.circular(12));
});
});
group('Button Themes', () {
test('elevated button has padding', () {
final theme = AppTheme.light;
final buttonStyle = theme.elevatedButtonTheme.style;
expect(buttonStyle, isNotNull);
});
test('text button has padding', () {
final theme = AppTheme.light;
final buttonStyle = theme.textButtonTheme.style;
expect(buttonStyle, isNotNull);
});
});
group('Card Theme', () {
test('cards have no elevation', () {
final theme = AppTheme.light;
expect(theme.cardTheme.elevation, 0);
});
test('cards have rounded corners', () {
final theme = AppTheme.light;
final shape = theme.cardTheme.shape as RoundedRectangleBorder?;
expect(shape?.borderRadius, BorderRadius.circular(12));
});
});
}