mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
Add Value bool conversion to C++
This commit is contained in:
parent
a34d6e6563
commit
831bf58baa
3 changed files with 26 additions and 2 deletions
|
@ -59,4 +59,15 @@ SCENARIO("Value API")
|
|||
REQUIRE(number_opt.has_value());
|
||||
REQUIRE(number_opt.value() == number);
|
||||
}
|
||||
|
||||
SECTION("Construct a bool")
|
||||
{
|
||||
REQUIRE(!value.to_bool().has_value());
|
||||
value = Value(true);
|
||||
REQUIRE(value.type() == Value::Type::Bool);
|
||||
|
||||
auto bool_opt = value.to_bool();
|
||||
REQUIRE(bool_opt.has_value());
|
||||
REQUIRE(bool_opt.value() == true);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue