Skip to content

Commit

Permalink
Added some tests after the fact for flutter#17499 (flutter#17714)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaaclarke authored and goderbauer committed Apr 16, 2020
1 parent cf83d79 commit 16469ae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,30 @@ - (void)testCreate {
XCTAssertNotNil(object);
}

- (void)testSetChildren {
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
new flutter::MockAccessibilityBridge());
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
SemanticsObject* parent = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
SemanticsObject* child = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
parent.children = @[ child ];
XCTAssertEqual(parent, child.parent);
parent.children = @[];
XCTAssertNil(child.parent);
}

- (void)testReplaceChildAtIndex {
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
new flutter::MockAccessibilityBridge());
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
SemanticsObject* parent = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
SemanticsObject* child1 = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
SemanticsObject* child2 = [[SemanticsObject alloc] initWithBridge:bridge uid:2];
parent.children = @[ child1 ];
[parent replaceChildAtIndex:0 withChild:child2];
XCTAssertNil(child1.parent);
XCTAssertEqual(parent, child2.parent);
XCTAssertEqualObjects(parent.children, @[ child2 ]);
}

@end
2 changes: 2 additions & 0 deletions testing/ios/IosUnitTests/build_and_run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

set -e

FLUTTER_ENGINE=ios_debug_sim_unopt

if [ $# -eq 1 ]; then
Expand Down

0 comments on commit 16469ae

Please sign in to comment.