forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made it so unit tests can be written against all ios engine code. (fl…
- Loading branch information
Showing
7 changed files
with
271 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#import <OCMock/OCMock.h> | ||
#import <XCTest/XCTest.h> | ||
|
||
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h" | ||
#import "flutter/shell/platform/darwin/ios/framework/Source/SemanticsObject.h" | ||
|
||
FLUTTER_ASSERT_ARC | ||
|
||
namespace flutter { | ||
namespace { | ||
class MockAccessibilityBridge : public AccessibilityBridgeIos { | ||
public: | ||
MockAccessibilityBridge() { view_ = [[UIView alloc] init]; } | ||
UIView* view() const override { return view_; } | ||
UIView<UITextInput>* textInputView() override { return nil; } | ||
void DispatchSemanticsAction(int32_t id, SemanticsAction action) override {} | ||
void DispatchSemanticsAction(int32_t id, | ||
SemanticsAction action, | ||
std::vector<uint8_t> args) override {} | ||
FlutterPlatformViewsController* GetPlatformViewsController() const override { return nil; } | ||
|
||
private: | ||
UIView* view_; | ||
}; | ||
} // namespace | ||
} // namespace flutter | ||
|
||
@interface SemanticsObjectTest : XCTestCase | ||
@end | ||
|
||
@implementation SemanticsObjectTest | ||
|
||
- (void)testCreate { | ||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory( | ||
new flutter::MockAccessibilityBridge()); | ||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr(); | ||
SemanticsObject* object = [[SemanticsObject alloc] initWithBridge:bridge uid:0]; | ||
XCTAssertNotNil(object); | ||
} | ||
|
||
@end |
Oops, something went wrong.