2018-08-18 17:18:22 -04:00
|
|
|
"""Tests for app lib
|
|
|
|
|
|
|
|
Very limited at the moment since we can't test the main input dialogs"""
|
|
|
|
|
|
|
|
___license___ = "MIT"
|
2018-08-21 15:47:39 -04:00
|
|
|
___dependencies___ = ["upip:unittest", "dialogs", "sleep", "ugfx_helper"]
|
2018-08-18 17:18:22 -04:00
|
|
|
|
2018-08-21 15:47:39 -04:00
|
|
|
import unittest, ugfx, ugfx_helper
|
2018-08-18 17:18:22 -04:00
|
|
|
from machine import Pin
|
|
|
|
from dialogs import *
|
|
|
|
from sleep import *
|
|
|
|
|
|
|
|
class TestDialogs(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUpClass(self):
|
2018-08-21 15:47:39 -04:00
|
|
|
ugfx_helper.init()
|
2018-08-18 17:18:22 -04:00
|
|
|
|
|
|
|
def tearDownClass(self):
|
2018-08-21 15:47:39 -04:00
|
|
|
ugfx_helper.deinit()
|
|
|
|
|
2018-08-31 09:22:55 -04:00
|
|
|
def test_waiting(self):
|
|
|
|
count_max = 3
|
|
|
|
with WaitingMessage("Testing...", "Foo") as c:
|
|
|
|
for i in range(1, count_max):
|
|
|
|
c.text = "%d/%d" % (i, count_max)
|
|
|
|
|
|
|
|
print("done")
|
|
|
|
|
|
|
|
def test_text(self):
|
2018-08-21 15:47:39 -04:00
|
|
|
prompt_text("description")
|
2018-08-18 17:18:22 -04:00
|
|
|
|
2018-08-26 06:39:04 -04:00
|
|
|
def test_option(self):
|
2018-08-31 09:22:55 -04:00
|
|
|
print(prompt_option(["foo", "bar", "baz"]))
|
2018-08-26 06:39:04 -04:00
|
|
|
|
2018-08-18 17:18:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|