Skip to content

Commit

Permalink
Merge pull request #230 from natsuk4ze/refactor
Browse files Browse the repository at this point in the history
refactor test
  • Loading branch information
natsuk4ze authored Jul 31, 2024
2 parents 9995324 + 682cda1 commit d925718
Showing 1 changed file with 11 additions and 14 deletions.
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;
}

0 comments on commit d925718

Please sign in to comment.