Skip to content

Commit b4e21da

Browse files
committed
add test_widgets module with DragDropLineEdit tests
1 parent 9c3e1c1 commit b4e21da

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_widgets.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import pytest
2+
3+
from PyQt5.QtWidgets import QWidget
4+
from PyQt5.QtTest import QTest
5+
6+
from slice.ui.widgets import DragDropLineEdit
7+
8+
9+
def test_drag_drop_line_edit(qtbot):
10+
widget1 = QWidget()
11+
widget2 = DragDropLineEdit(widget1)
12+
# placeholder text
13+
assert (
14+
widget2.placeholderText() == "Drop a variable font here or click the Open button"
15+
)
16+
assert widget2.isEnabled() is True
17+
# accepts drops
18+
assert widget2.acceptDrops() is True
19+
# uses a clear button
20+
assert widget2.isClearButtonEnabled() is True
21+
# test text entry
22+
assert widget2.text() == ""
23+
QTest.keyClicks(widget2, "test")
24+
assert widget2.text() == "test"

0 commit comments

Comments
 (0)