Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor test #230

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions example/integration_test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import 'package:gal/gal.dart';
/// Integration_test is required to test native code,
/// but it is not necessary to build the widget.
Future<void> main() async {
for (var i = 0; i < TestCase.values.length; i++) {
final testCase = TestCase.values[i];
final testCases = [
for (final isSavedToAlbum in [true, false])
TestCase(isSavedToAlbum: isSavedToAlbum),
];

for (final testCase in testCases) {
final toAlbum = testCase.toAlbum;
final album = testCase.album;

Expand Down Expand Up @@ -72,17 +76,10 @@ Future<Uint8List> getBytesData(String path) async {
return Uint8List.fromList(uint8List);
}

enum TestCase {
saveToAlbum,
notSaveToAlbum;

bool get toAlbum => switch (this) {
saveToAlbum => true,
notSaveToAlbum => false,
};
class TestCase {
const TestCase({required this.isSavedToAlbum});
final bool isSavedToAlbum;

String? get album => switch (this) {
saveToAlbum => 'toAlbum',
notSaveToAlbum => null,
};
bool get toAlbum => isSavedToAlbum;
String? get album => isSavedToAlbum ? 'album' : null;
}
Loading