mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
Iterator over interpreter::Struct
This commit is contained in:
parent
a3d0f3155d
commit
8a14c4fa25
2 changed files with 68 additions and 6 deletions
|
@ -172,4 +172,19 @@ SCENARIO("Struct API")
|
|||
REQUIRE(value.to_string().has_value());
|
||||
REQUIRE(value.to_string().value() == "Hallo");
|
||||
|
||||
int count = 0;
|
||||
for (auto [k, value] : struc) {
|
||||
REQUIRE(count == 0);
|
||||
count ++;
|
||||
REQUIRE(k == "field_a");
|
||||
REQUIRE(value.to_string().value() == "Hallo");
|
||||
}
|
||||
|
||||
struc.set_field("field_b", Value(sixtyfps::SharedString("World")));
|
||||
std::map<std::string, sixtyfps::SharedString> map;
|
||||
for (auto [k, value] : struc) map[std::string(k)] = *value.to_string();
|
||||
|
||||
REQUIRE(map == std::map<std::string, sixtyfps::SharedString>{ {"field_a", sixtyfps::SharedString("Hallo") }, {"field_b", sixtyfps::SharedString("World") } });
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue