File: test_enum_flags.py

package info (click to toggle)
cambalache 0.99.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,952 kB
  • sloc: python: 19,276; xml: 13,029; ansic: 10,781; sql: 421; makefile: 211; sh: 11
file content (39 lines) | stat: -rw-r--r-- 986 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/pytest

import os

from cambalache import CmbProject


def enum_and_flags_test(widget_name):
    project = CmbProject(target_tk="gtk-4.0")
    project.import_file(os.path.join(os.path.dirname(__file__), "gtk-4.0", "enum_and_flags.ui"))

    widget = project.get_object_by_name(1, widget_name)
    input_hints = widget.properties_dict["input-hints"]
    assert (input_hints)
    assert (input_hints.value == "emoji|lowercase|private")

    input_purpose = widget.properties_dict["input-purpose"]
    assert (input_purpose)
    assert (input_purpose.value == "digits")

    valign = widget.properties_dict["valign"]
    assert (valign)
    assert (valign.value == "center")


def test_enum_and_flags_as_nick():
    enum_and_flags_test("nick")


def test_enum_and_flags_as_name():
    enum_and_flags_test("name")


def test_enum_and_flags_as_nick_and_name():
    enum_and_flags_test("nick_name")


def test_enum_and_flags_as_integer_values():
    enum_and_flags_test("integer")