mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-28 04:45:13 +00:00

Updated the version from 1.1 to 1.2 Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License" Added definition of "Mobile Application" and grant of right Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage Moved the para on copyright notices to section under "Limitations"
48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
# Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.2 OR LicenseRef-Slint-commercial
|
|
|
|
from slint import slint as native
|
|
|
|
Color = native.PyColor
|
|
Brush = native.PyBrush
|
|
|
|
|
|
def test_col_default():
|
|
col = Color()
|
|
assert col.red == 0
|
|
assert col.green == 0
|
|
assert col.blue == 0
|
|
assert col.alpha == 0
|
|
|
|
|
|
def test_col_from_str():
|
|
col = Color("#123456")
|
|
assert col.red == 0x12
|
|
assert col.green == 0x34
|
|
assert col.blue == 0x56
|
|
assert col.alpha == 255
|
|
assert str(col) == "argb(255, 18, 52, 86)"
|
|
|
|
|
|
def test_col_from_rgb_dict():
|
|
coldict = {'red': 0x12, 'green': 0x34, 'blue': 0x56}
|
|
col = Color(coldict)
|
|
assert col.red == 0x12
|
|
assert col.green == 0x34
|
|
assert col.blue == 0x56
|
|
assert col.alpha == 255
|
|
|
|
|
|
def test_col_from_rgba_dict():
|
|
coldict = {'red': 0x12, 'green': 0x34, 'blue': 0x56, 'alpha': 128}
|
|
col = Color(coldict)
|
|
assert col.red == 0x12
|
|
assert col.green == 0x34
|
|
assert col.blue == 0x56
|
|
assert col.alpha == 128
|
|
|
|
|
|
def test_from_col():
|
|
col = Color("#123456")
|
|
brush = Brush(col)
|
|
assert brush.color == col
|