mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-16 09:35:21 +00:00
Python: Add support for assigning colors directly to brushes
This commit is contained in:
parent
3c9b57ecf8
commit
3e66b98121
3 changed files with 12 additions and 2 deletions
|
@ -31,7 +31,7 @@ def test_property_access():
|
|||
in property <bool> boolprop: true;
|
||||
in property <image> imgprop;
|
||||
in property <brush> brushprop: Colors.rgb(255, 0, 255);
|
||||
in property <color> colprop;
|
||||
in property <color> colprop: Colors.rgb(0, 255, 0);
|
||||
in property <[string]> modelprop;
|
||||
in property <MyStruct> structprop: {
|
||||
title: "builtin",
|
||||
|
@ -104,6 +104,12 @@ def test_property_access():
|
|||
brushval = instance.get_property("brushprop")
|
||||
assert str(brushval.color) == "argb(255, 128, 128, 128)"
|
||||
|
||||
brushval = instance.get_property("colprop")
|
||||
assert str(brushval.color) == "argb(255, 0, 255, 0)"
|
||||
instance.set_property("colprop", Color("rgb(128, 128, 128)"))
|
||||
brushval = instance.get_property("colprop")
|
||||
assert str(brushval.color) == "argb(255, 128, 128, 128)"
|
||||
|
||||
with pytest.raises(ValueError, match="no such property"):
|
||||
instance.set_global_property("nonexistent", "theglobalprop", 42)
|
||||
with pytest.raises(ValueError, match="no such property"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue