diff --git a/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm b/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm index 8ec62338ab825..21bd5611beee1 100644 --- a/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm +++ b/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm @@ -38,4 +38,30 @@ - (void)testCreate { XCTAssertNotNil(object); } +- (void)testSetChildren { + fml::WeakPtrFactory factory( + new flutter::MockAccessibilityBridge()); + fml::WeakPtr 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 factory( + new flutter::MockAccessibilityBridge()); + fml::WeakPtr 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 diff --git a/testing/ios/IosUnitTests/build_and_run_tests.sh b/testing/ios/IosUnitTests/build_and_run_tests.sh index 0c586192d9490..833459c019d45 100755 --- a/testing/ios/IosUnitTests/build_and_run_tests.sh +++ b/testing/ios/IosUnitTests/build_and_run_tests.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + FLUTTER_ENGINE=ios_debug_sim_unopt if [ $# -eq 1 ]; then