test_lib_busy.py 1.75 KB
Newer Older
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 52 53 54 55 56 57 58 59 60
import unittest
from unittests import wtc
import wx
import os

from wx.lib.busy import BusyInfo

delay = 100

#---------------------------------------------------------------------------

class lib_busy_Tests(wtc.WidgetTestCase):

    def test_lib_busy1(self):
        with BusyInfo("short message...", self.frame):
            wx.MilliSleep(delay*2)
        wx.MilliSleep(delay)
        self.myYield()

    def test_lib_busy2(self):
        with BusyInfo("This is my longer short message.  Please be patient...", self.frame):
            wx.MilliSleep(delay*2)
        wx.MilliSleep(delay)
        self.myYield()

    def test_lib_busy3(self):
        busy = BusyInfo("Without using the context manager...", self.frame)
        wx.MilliSleep(delay*2)
        del busy
        wx.MilliSleep(delay)
        self.myYield()

    def test_lib_busy4(self):
        with BusyInfo("Without using the parent window..."):
            wx.MilliSleep(delay*2)
        wx.MilliSleep(delay)
        self.myYield()

    def test_lib_busy5(self):
        message = """A long message with line breaks:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum."""
        with BusyInfo(message, self.frame):
            wx.MilliSleep(delay*2)
        wx.MilliSleep(delay)
        self.myYield()




#---------------------------------------------------------------------------


if __name__ == '__main__':
    unittest.main()