mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Expose Value::to_string()
conversion and construction in C++
This commit is contained in:
parent
6e9d4f9e8d
commit
8e72d29669
3 changed files with 64 additions and 8 deletions
|
@ -32,7 +32,19 @@ SCENARIO("SharedString API")
|
|||
SCENARIO("Value API")
|
||||
{
|
||||
using namespace sixtyfps::interpreter;
|
||||
Value str;
|
||||
Value value;
|
||||
|
||||
REQUIRE(str.type() == Value::Type::Void);
|
||||
REQUIRE(value.type() == Value::Type::Void);
|
||||
|
||||
SECTION("Construct a string")
|
||||
{
|
||||
REQUIRE(!value.to_string().has_value());
|
||||
sixtyfps::SharedString cpp_str("Hello World");
|
||||
value = Value(cpp_str);
|
||||
REQUIRE(value.type() == Value::Type::String);
|
||||
|
||||
auto string_opt = value.to_string();
|
||||
REQUIRE(string_opt.has_value());
|
||||
REQUIRE(string_opt.value() == "Hello World");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue