@@ -2,6 +2,8 @@ import 'package:checks/checks.dart';
2
2
import 'package:flutter/material.dart' ;
3
3
import 'package:flutter/rendering.dart' ;
4
4
import 'package:flutter_test/flutter_test.dart' ;
5
+ import 'package:get/get.dart' ;
6
+ import 'package:zulip/themes/appbar_theme.dart' ;
5
7
import 'package:zulip/widgets/channel_colors.dart' ;
6
8
import 'package:zulip/widgets/text.dart' ;
7
9
import 'package:zulip/widgets/theme.dart' ;
@@ -133,4 +135,54 @@ void main() {
133
135
.isSameColorSwatchAs (ChannelColorSwatch .dark (baseColor));
134
136
});
135
137
});
138
+
139
+ group ('AppBarTheme Tests' , () {
140
+ testWidgets ('Light AppBarTheme Test' , (tester) async {
141
+ final designVariables = DesignVariables .light ();
142
+
143
+ await tester.pumpWidget (GetMaterialApp (
144
+ home: Scaffold (
145
+ appBar: AppBar (
146
+ title: const Text ('Test' ),
147
+ ),
148
+ ),
149
+ ));
150
+
151
+ final context = Get .context;
152
+
153
+ final appBarTheme = ZAppBarTheme .getAppBarTheme (context! , designVariables);
154
+
155
+ // Validate AppBar properties for light theme
156
+ expect (appBarTheme.backgroundColor, designVariables.bgTopBar);
157
+ expect (appBarTheme.actionsIconTheme! .color, designVariables.icon);
158
+ expect (appBarTheme.titleTextStyle! .color, designVariables.title);
159
+ expect (appBarTheme.titleTextStyle! .fontSize, 20 );
160
+ expect (appBarTheme.titleTextStyle! .fontFamily, kDefaultFontFamily);
161
+
162
+ });
163
+
164
+ testWidgets ('Dark AppBarTheme Test' , (tester) async {
165
+ final designVariables = DesignVariables .dark ();
166
+
167
+ await tester.pumpWidget (GetMaterialApp (
168
+ home: Scaffold (
169
+ appBar: AppBar (
170
+ title: const Text ('Test' ),
171
+ ),
172
+ ),
173
+ ));
174
+
175
+ final context = Get .context;
176
+
177
+ final appBarTheme = ZAppBarTheme .getAppBarTheme (context! , designVariables);
178
+
179
+ // Validate AppBar properties for dark theme
180
+ expect (appBarTheme.backgroundColor, designVariables.bgTopBar);
181
+ expect (appBarTheme.actionsIconTheme! .color, designVariables.icon);
182
+ expect (appBarTheme.titleTextStyle! .color, designVariables.title);
183
+ expect (appBarTheme.titleTextStyle! .fontSize, 20 );
184
+ expect (appBarTheme.titleTextStyle! .fontFamily, kDefaultFontFamily);
185
+
186
+ });
187
+ });
136
188
}
0 commit comments