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

[camera] Manual roll and skip failing tests #7891

Merged
merged 9 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
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
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting nit can you include {} around this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection conditionals can't use braces, unfortunately.

'compileSdk': <String>['compileSdk = 34']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this pr but this should probably be 35.

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'
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this due to the minSdkVersion being 21, but I'll look into that as a follow-up.

},
regexReplacements: <RegExp, List<String>>{
// Tests for https://github.com/flutter/flutter/issues/43383
Expand Down