File: test_textbox.py

package info (click to toggle)
qtile 0.34.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,004 kB
  • sloc: python: 49,959; ansic: 4,371; xml: 324; sh: 260; makefile: 218
file content (35 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download
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
import pytest

import libqtile.bar
import libqtile.config
from libqtile import widget


@pytest.mark.parametrize("position", ["top", "bottom", "left", "right"])
def test_text_box_bar_orientations(manager_nospawn, minimal_conf_noscreen, position):
    """Text boxes are available on any bar position."""
    textbox = widget.TextBox(text="Testing")

    config = minimal_conf_noscreen
    config.screens = [libqtile.config.Screen(**{position: libqtile.bar.Bar([textbox], 10)})]

    manager_nospawn.start(config)
    tbox = manager_nospawn.c.widget["textbox"]

    assert tbox.info()["text"] == "Testing"

    tbox.update("Updated")
    assert tbox.info()["text"] == "Updated"


def test_text_box_max_chars(manager_nospawn, minimal_conf_noscreen):
    """Text boxes are available on any bar position."""
    textbox = widget.TextBox(text="Testing", max_chars=4)

    config = minimal_conf_noscreen
    config.screens = [libqtile.config.Screen(top=libqtile.bar.Bar([textbox], 10))]

    manager_nospawn.start(config)
    tbox = manager_nospawn.c.widget["textbox"]

    assert tbox.info()["text"] == "Test…"