-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from 3Dpass/dev
FEATURE: Objects explorer. Version 2.12.0+34
- Loading branch information
Showing
93 changed files
with
2,163 additions
and
1,101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:auto_route/auto_route.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
import 'package:threedpass/core/widgets/buttons/elevated_button.dart'; | ||
import 'package:threedpass/features/hashes_list/bloc/hashes_list_bloc.dart'; | ||
import 'package:threedpass/features/hashes_list/domain/entities/snapshot_create_from_file/snapshot_create_from_file.dart'; | ||
import 'package:threedpass/features/scan_page/bloc/scan_isolate_cubit.dart'; | ||
import 'package:threedpass/features/scan_page/presentation/widgets/get_object_from_file_button.dart'; | ||
import 'package:threedpass/features/settings_page/bloc/settings_page_cubit.dart'; | ||
import 'package:threedpass/router/router.gr.dart'; | ||
|
||
import './test_app.dart'; | ||
|
||
void main() { | ||
// config(); | ||
final app = TestApp.instance; | ||
|
||
group('Example test', () { | ||
testWidgets('MyWidget has a title and message', (tester) async { | ||
print('aaaaaaa1'); | ||
// Initial pump | ||
await tester.pumpWidget(app); | ||
print('aaaaaaa2'); | ||
|
||
final filePath = '${Directory.current.path}/resources/3dpass-487203.obj'; | ||
// final Uri basedir = (goldenFileComparator. as LocalFileComparator).basedir; | ||
// matchesGoldenFile(key) | ||
// print(basedir.path); | ||
|
||
// final file = await rootBundle.load(filePath); | ||
// print(file.lengthInBytes); | ||
|
||
var dir = Directory.current; | ||
while (!await dir | ||
.list() | ||
.any((entity) => entity.path.endsWith('pubspec.yaml'))) { | ||
dir = dir.parent; | ||
} | ||
|
||
print(dir.absolute); | ||
print(Directory.current.listSync(recursive: true)); | ||
print(filePath); | ||
print(File(filePath).existsSync()); | ||
// for (var i in tester.allElements) { | ||
// print(i.widget.runtimeType); | ||
// } | ||
final BuildContext context = tester.element(find.byType(SizedBox)); | ||
|
||
final snapFactory = SnapshotFileFactory( | ||
showLoader: () {}, | ||
hashesListBloc: BlocProvider.of<HashesListBloc>(context), | ||
scanSettings: | ||
BlocProvider.of<SettingsConfigCubit>(context).state.scanSettings, | ||
// objectsDirectory: getIt<ObjectsDirectory>(), | ||
scanIsolateCubit: BlocProvider.of<ScanIsolateCubit>(context), | ||
// recievePort: recievePort, | ||
); | ||
|
||
final pair = await snapFactory.createSnapshotFromFile( | ||
pickedFilePath: filePath, | ||
relativePath: filePath, | ||
); | ||
|
||
await context.router.push( | ||
PreviewRouteWrapper( | ||
hashObject: pair.left, | ||
snapshot: pair.right, | ||
createNewAnyway: true, | ||
), | ||
); | ||
|
||
print('aaaaaaa3'); | ||
|
||
await tester.pumpAndSettle(); | ||
|
||
print('aaaaaaa4'); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:threedpass/features/wallet_screen/assets_page/widgets/balance_card/locked_balance_card.dart'; | ||
import 'package:threedpass/main.dart'; | ||
|
||
import '../test/test_config.dart'; | ||
|
||
// import 'test_config.dart'; | ||
import './scan_page_test.dart' as scan_page; | ||
// import 'utils/assets_formatting.dart' as assets_formating; | ||
|
||
/// Test all | ||
void main() { | ||
config(); | ||
|
||
// assets_formating.main(); | ||
|
||
scan_page.main(); | ||
|
||
// Prepare to widget-testing | ||
// setUpAll(() async { | ||
// SharedPreferences.setMockInitialValues({}); | ||
// await service_locator.setup(); | ||
// }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:threedpass/main.dart'; | ||
|
||
class TestApp { | ||
TestApp._(); | ||
|
||
static final Widget instance = EasyLocalization( | ||
supportedLocales: const [ | ||
Locale('en'), | ||
Locale('es'), | ||
Locale('sr'), | ||
], | ||
path: 'assets/translations', | ||
fallbackLocale: const Locale('en'), | ||
child: ThreeDApp(), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
import 'package:threedpass/core/persistence/hive_setup.dart' as hive_setup; | ||
import 'package:threedpass/setup.dart' as di_setup; | ||
|
||
Future<void> config() async { | ||
setUpAll(() async { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
await hive_setup.hiveSetup(); | ||
await di_setup.setup(); | ||
await EasyLocalization.ensureInitialized(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class D3pCardTheme { | ||
static Radius get radius => const Radius.circular(4.0); | ||
static const Radius radius = Radius.circular(4.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart'; | ||
import 'package:threedpass/core/theme/d3p_appbar_theme.dart'; | ||
|
||
class TitleNButtonAppBar extends PlatformAppBar { | ||
TitleNButtonAppBar({ | ||
required final String titleText, | ||
required final Widget trailingAction, | ||
final bool translateAppbar = true, | ||
super.key, | ||
}) : super( | ||
automaticallyImplyLeading: false, | ||
backgroundColor: const D3pAppBarTheme().backgroundColor, | ||
cupertino: (final context, final platform) => | ||
CupertinoNavigationBarData(padding: EdgeInsetsDirectional.zero), | ||
material: (final context, final platform) => MaterialAppBarData( | ||
titleSpacing: 0, | ||
), | ||
title: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.only(left: 16), | ||
child: Text( | ||
translateAppbar ? titleText.tr() : titleText, | ||
textAlign: TextAlign.start, | ||
style: const TextStyle(color: Colors.white), | ||
), | ||
), | ||
trailingAction, | ||
], | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.