Skip to content

Commit

Permalink
Merge branch 'main' into feat/buildUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
girishramnani authored Jun 22, 2024
2 parents 84b4553 + 45d8950 commit 622d820
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion easel/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies:
collection: ^1.16.0
cupertino_icons: ^1.0.2
dartz: ^0.10.0
detectable_text_field: ^2.0.4
detectable_text_field: ^3.0.2
device_preview: 1.1.0
dio: ^5.0.1
easy_localization:
Expand Down
20 changes: 15 additions & 5 deletions easel/test/extensions/size_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,30 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:shared_preferences/shared_preferences.dart';

extension SetScreenSize on WidgetTester {
Future<void> setScreenSize({double width = 480, double height = 965, double pixelDensity = 1}) async {
Future<void> setScreenSize(
{double width = 480,
double height = 965,
double pixelDensity = 1}) async {
final size = Size(width, height);
await binding.setSurfaceSize(size);
view.physicalSize = size;
view.devicePixelRatio = pixelDensity;
}

Future testAppForWidgetTesting(Widget child, {Duration duration = Duration.zero}) async {
Future testAppForWidgetTesting(Widget child,
{Duration duration = Duration.zero}) async {
SharedPreferences.setMockInitialValues({});

await EasyLocalization.ensureInitialized();

return pumpWidget(Builder(builder: (context) {
return EasyLocalization(
supportedLocales: const [Locale('en', 'US'), Locale('ru', 'RU'), Locale('es'), Locale('de')],
supportedLocales: const [
Locale('en', 'US'),
Locale('ru', 'RU'),
Locale('es'),
Locale('de')
],
path: 'i18n',
fallbackLocale: const Locale('en'),
useOnlyLangCode: true,
Expand All @@ -36,7 +45,8 @@ extension SetScreenSize on WidgetTester {
builder: (context, widget) {
ScreenUtil.init(context);
return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.noScaling),
data: MediaQuery.of(context)
.copyWith(textScaler: TextScaler.noScaling),
child: widget!,
);
},
Expand All @@ -45,6 +55,6 @@ extension SetScreenSize on WidgetTester {
},
),
);
}), duration);
}));
}
}

0 comments on commit 622d820

Please sign in to comment.