-
-
Notifications
You must be signed in to change notification settings - Fork 216
/
Copy pathtest_tkspinbox.py
51 lines (42 loc) · 1.44 KB
/
test_tkspinbox.py
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
40
41
42
43
44
45
46
47
48
49
50
51
# encoding: utf-8
import os
import sys
import unittest
import tkinter as tk
import tkinter.ttk as ttk
import fixpath
import pygubu
import support
class TestTkSpinbox(unittest.TestCase):
def setUp(self):
support.root_deiconify()
xmldata = "test_tkspinbox.ui"
self.builder = builder = pygubu.Builder()
builder.add_from_file(xmldata)
def tearDown(self):
support.root_withdraw()
def test_class(self):
self.widget = self.builder.get_object("test_from")
self.spinbox = self.builder.get_object("spinbox1")
self.assertIsInstance(self.spinbox, tk.Spinbox)
self.widget.destroy()
def test_from_(self):
self.widget = self.builder.get_object("test_from")
spinbox = self.builder.get_object("spinbox1")
value = spinbox.cget("from")
self.assertEqual(5, value)
self.widget.destroy()
def test_to(self):
self.widget = self.builder.get_object("test_to")
spinbox = self.builder.get_object("spinbox2")
value = spinbox.cget("to")
self.assertEqual(10, value)
self.widget.destroy()
def test_from_to(self):
self.widget = self.builder.get_object("test_from_to")
spinbox = self.builder.get_object("spinbox3")
value_from = spinbox.cget("from")
value_to = spinbox.cget("to")
self.assertEqual(2, value_from)
self.assertEqual(10, value_to)
self.widget.destroy()