Skip to content

Commit c086751

Browse files
authored
[macOS] Fix test fixture identifier style (flutter#33118)
Rename the C++ style can_composite_platform_views and native_callback functions to the Dart-style identifiers canCompositePlatformViews and nativeCallback in the macOS desktop test fixtures. Also corrects the helper method identifier from CreateSimplePicture to _createSimplePicture, thus making it library-private to help readers understand it's a local helper. Ref: [Flutter Style Guide](https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#naming) Ref: [Effective Dart](https://dart.dev/guides/language/effective-dart/style#do-name-other-identifiers-using-lowercamelcase)
1 parent 22593da commit c086751

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ @interface FlutterEngine (Test)
357357

358358
TEST_F(FlutterEngineTest, NativeCallbacks) {
359359
FlutterEngine* engine = GetFlutterEngine();
360-
EXPECT_TRUE([engine runWithEntrypoint:@"native_callback"]);
360+
EXPECT_TRUE([engine runWithEntrypoint:@"nativeCallback"]);
361361
EXPECT_TRUE(engine.running);
362362

363363
fml::AutoResetWaitableEvent latch;
@@ -384,7 +384,7 @@ @interface FlutterEngine (Test)
384384
viewController.flutterView.frame = CGRectMake(0, 0, 800, 600);
385385
[engine setViewController:viewController];
386386

387-
EXPECT_TRUE([engine runWithEntrypoint:@"can_composite_platform_views"]);
387+
EXPECT_TRUE([engine runWithEntrypoint:@"canCompositePlatformViews"]);
388388

389389
// Latch to ensure the entire layer tree has been generated and presented.
390390
fml::AutoResetWaitableEvent latch;

shell/platform/darwin/macos/framework/Source/fixtures/flutter_desktop_test.dart

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,30 @@ void canLogToStdout() {
1616
signalNativeTest();
1717
}
1818

19-
Picture CreateSimplePicture() {
20-
Paint blackPaint = Paint();
21-
PictureRecorder baseRecorder = PictureRecorder();
22-
Canvas canvas = Canvas(baseRecorder);
23-
canvas.drawRect(Rect.fromLTRB(0.0, 0.0, 1000.0, 1000.0), blackPaint);
24-
return baseRecorder.endRecording();
25-
}
26-
2719
@pragma('vm:entry-point')
28-
void can_composite_platform_views() {
20+
void canCompositePlatformViews() {
2921
PlatformDispatcher.instance.onBeginFrame = (Duration duration) {
3022
SceneBuilder builder = SceneBuilder();
31-
builder.addPicture(Offset(1.0, 1.0), CreateSimplePicture());
23+
builder.addPicture(Offset(1.0, 1.0), _createSimplePicture());
3224
builder.pushOffset(1.0, 2.0);
3325
builder.addPlatformView(42, width: 123.0, height: 456.0);
34-
builder.addPicture(Offset(1.0, 1.0), CreateSimplePicture());
26+
builder.addPicture(Offset(1.0, 1.0), _createSimplePicture());
3527
builder.pop(); // offset
3628
PlatformDispatcher.instance.views.first.render(builder.build());
3729
};
3830
PlatformDispatcher.instance.scheduleFrame();
3931
}
4032

33+
/// Returns a [Picture] of a simple black square.
34+
Picture _createSimplePicture() {
35+
Paint blackPaint = Paint();
36+
PictureRecorder baseRecorder = PictureRecorder();
37+
Canvas canvas = Canvas(baseRecorder);
38+
canvas.drawRect(Rect.fromLTRB(0.0, 0.0, 1000.0, 1000.0), blackPaint);
39+
return baseRecorder.endRecording();
40+
}
41+
4142
@pragma('vm:entry-point')
42-
void native_callback() {
43+
void nativeCallback() {
4344
signalNativeTest();
4445
}

0 commit comments

Comments
 (0)