| 8 | using namespace bdn::ui; |
| 9 | |
| 10 | TEST(ContainerView, childIndex) |
| 11 | { |
| 12 | bdn::App()->dispatchQueue()->dispatchSync([=]() { |
| 13 | const auto container = std::make_shared<ContainerView>(); |
| 14 | const auto children = {std::make_shared<Button>(), std::make_shared<Button>(), std::make_shared<Button>()}; |
| 15 | |
| 16 | for (auto child : children) { |
| 17 | container->addChildView(child); |
| 18 | } |
| 19 | |
| 20 | int i = 0; |
| 21 | for (auto it = children.begin(); it != children.end(); ++it, ++i) { |
| 22 | EXPECT_EQ(container->childIndex(*it), i); |
| 23 | } |
| 24 | |
| 25 | container->removeAllChildViews(); |
| 26 | |
| 27 | for (auto it = children.begin(); it != children.end(); ++it) { |
| 28 | EXPECT_EQ(container->childIndex(*it), std::nullopt); |
| 29 | } |
| 30 | }); |
| 31 | } |
| 32 | } |
nothing calls this directly
no test coverage detected