Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
[macOS] Replace fixture subclasses with usings (#48111)
Browse files Browse the repository at this point in the history
In cases where we subclassed gtest fixtures purely to get better naming for test output (i.e. displaying/filtering on AccessibilityBridgeMacTest instead of AutoreleasePoolTest, replace these with `using` declarations, which is equally effective and avoids actually subclassing.

This applies no semantic changes to the code or tests.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
  • Loading branch information
cbracken authored Nov 16, 2023
1 parent ea42577 commit eb5b20d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,11 @@ @implementation AccessibilityBridgeTestViewController
FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridgeMacWindowTest);
};

// AutoreleasePoolTest subclass that exists simply to provide more specific naming.
class AccessibilityBridgeMacTest : public AutoreleasePoolTest {
public:
AccessibilityBridgeMacTest() = default;
~AccessibilityBridgeMacTest() = default;

private:
FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridgeMacTest);
};

NSWindow* AccessibilityBridgeMacWindowTest::gWindow_ = nil;

// Test-specific name for AutoreleasePoolTest fixture.
using AccessibilityBridgeMacTest = AutoreleasePoolTest;

} // namespace

TEST_F(AccessibilityBridgeMacWindowTest, SendsAccessibilityCreateNotificationFlutterViewWindow) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,8 @@ - (CVPixelBufferRef)pixelBuffer {

namespace flutter::testing {

// AutoreleasePoolTest subclass that exists simply to provide more specific naming.
class FlutterEmbedderExternalTextureTest : public AutoreleasePoolTest {
public:
FlutterEmbedderExternalTextureTest() = default;
~FlutterEmbedderExternalTextureTest() = default;

private:
FML_DISALLOW_COPY_AND_ASSIGN(FlutterEmbedderExternalTextureTest);
};
// Test-specific name for AutoreleasePoolTest fixture.
using FlutterEmbedderExternalTextureTest = AutoreleasePoolTest;

TEST_F(FlutterEmbedderExternalTextureTest, TestTextureResolution) {
// Constants.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,25 +174,9 @@ id MockGestureEvent(NSEventType type, NSEventPhase phase, double magnification,

#pragma mark - gtest tests

// AutoreleasePoolTest subclass that exists simply to provide more specific naming.
class FlutterViewControllerTest : public AutoreleasePoolTest {
public:
FlutterViewControllerTest() = default;
~FlutterViewControllerTest() = default;

private:
FML_DISALLOW_COPY_AND_ASSIGN(FlutterViewControllerTest);
};

// MockFlutterEngineTest subclass that exists simply to provide more specific naming.
class FlutterViewControllerMockEngineTest : public MockFlutterEngineTest {
public:
FlutterViewControllerMockEngineTest() = default;
~FlutterViewControllerMockEngineTest() = default;

private:
FML_DISALLOW_COPY_AND_ASSIGN(FlutterViewControllerMockEngineTest);
};
// Test-specific names for AutoreleasePoolTest, MockFlutterEngineTest fixtures.
using FlutterViewControllerTest = AutoreleasePoolTest;
using FlutterViewControllerMockEngineTest = MockFlutterEngineTest;

TEST_F(FlutterViewControllerTest, HasViewThatHidesOtherViewsInAccessibility) {
FlutterViewController* viewControllerMock = CreateMockViewController();
Expand Down

0 comments on commit eb5b20d

Please sign in to comment.