Exemplo n.º 1
0
def test_toggle_multiple():
    """
	Alternately toggle two windows and make sure we have only
	once instance of each window in the stack.
	"""
    windows = WindowManager()
    window1 = DummyWindow(windows)
    window2 = DummyWindow(windows)
    assert not window1.visible
    assert not window2.visible

    windows.toggle(window1)
    assert window1.visible
    assert not window2.visible

    windows.toggle(window2)
    assert not window1.visible
    assert window2.visible

    windows.toggle(window1)
    assert window1.visible
    assert not window2.visible

    windows.close()
    windows.close()
    assert not windows.visible
def test_toggle_multiple():
	"""
	Alternately toggle two windows and make sure we have only
	once instance of each window in the stack.
	"""
	windows = WindowManager()
	window1 = DummyWindow(windows)
	window2 = DummyWindow(windows)
	assert not window1.visible
	assert not window2.visible

	windows.toggle(window1)
	assert window1.visible
	assert not window2.visible

	windows.toggle(window2)
	assert not window1.visible
	assert window2.visible

	windows.toggle(window1)
	assert window1.visible
	assert not window2.visible

	windows.close()
	windows.close()
	assert not windows.visible
Exemplo n.º 3
0
def test_close():
    windows = WindowManager()
    window1 = DummyWindow(windows)
    window2 = DummyWindow(windows)
    windows.open(window1)
    windows.open(window2)
    assert not window1.visible
    assert window2.visible

    windows.close()
    assert window1.visible
    assert not window2.visible

    windows.close()
    assert not window1.visible
    assert not window2.visible
    assert not windows.visible
def test_close():
	windows = WindowManager()
	window1 = DummyWindow(windows)
	window2 = DummyWindow(windows)
	windows.open(window1)
	windows.open(window2)
	assert not window1.visible
	assert window2.visible

	windows.close()
	assert window1.visible
	assert not window2.visible

	windows.close()
	assert not window1.visible
	assert not window2.visible
	assert not windows.visible
Exemplo n.º 5
0
class TestWindowManager(unittest.TestCase):

	def setUp(self):
		self.windows = WindowManager()

	def test_trivial(self):
		assert not self.windows.visible

	def test_open_hide(self):
		window1 = DummyWindow(self.windows)
		self.windows.open(window1)
		assert self.windows.visible
		assert window1.visible

		window2 = DummyWindow(self.windows)
		self.windows.open(window2)
		assert self.windows.visible
		assert not window1.visible
		assert window2.visible

	def test_close(self):
		window1 = DummyWindow(self.windows)
		window2 = DummyWindow(self.windows)
		self.windows.open(window1)
		self.windows.open(window2)
		assert not window1.visible
		assert window2.visible

		self.windows.close()
		assert window1.visible
		assert not window2.visible

		self.windows.close()
		assert not window1.visible
		assert not window2.visible
		assert not self.windows.visible

	def test_toggle_single_window(self):
		window1 = DummyWindow(self.windows)
		assert not window1.visible

		self.windows.toggle(window1)
		assert window1.visible
		self.windows.toggle(window1)
		assert not window1.visible

	def test_toggle_multiple(self):
		"""
		Alternately toggle two windows and make sure we have only
		once instance of each window in the stack.
		"""
		window1 = DummyWindow(self.windows)
		window2 = DummyWindow(self.windows)
		assert not window1.visible
		assert not window2.visible

		self.windows.toggle(window1)
		assert window1.visible
		assert not window2.visible

		self.windows.toggle(window2)
		assert not window1.visible
		assert window2.visible

		self.windows.toggle(window1)
		assert window1.visible
		assert not window2.visible

		self.windows.close()
		self.windows.close()
		assert not self.windows.visible
class TestWindowManager(unittest.TestCase):

	def setUp(self):
		self.windows = WindowManager()

	def test_trivial(self):
		assert not self.windows.visible

	def test_show_hide(self):
		window1 = DummyWindow(self.windows)
		self.windows.show(window1)
		assert self.windows.visible
		assert window1.visible

		window2 = DummyWindow(self.windows)
		self.windows.show(window2)
		assert self.windows.visible
		assert not window1.visible
		assert window2.visible

	def test_close(self):
		window1 = DummyWindow(self.windows)
		window2 = DummyWindow(self.windows)
		self.windows.show(window1)
		self.windows.show(window2)
		assert not window1.visible
		assert window2.visible

		self.windows.close()
		assert window1.visible
		assert not window2.visible

		self.windows.close()
		assert not window1.visible
		assert not window2.visible
		assert not self.windows.visible

	def test_toggle_single_window(self):
		window1 = DummyWindow(self.windows)
		assert not window1.visible

		self.windows.toggle(window1)
		assert window1.visible
		self.windows.toggle(window1)
		assert not window1.visible

	def test_toggle_multiple(self):
		"""
		Alternately toggle two windows and make sure we have only
		once instance of each window in the stack.
		"""
		window1 = DummyWindow(self.windows)
		window2 = DummyWindow(self.windows)
		assert not window1.visible
		assert not window2.visible

		self.windows.toggle(window1)
		assert window1.visible
		assert not window2.visible

		self.windows.toggle(window2)
		assert not window1.visible
		assert window2.visible

		self.windows.toggle(window1)
		assert window1.visible
		assert not window2.visible

		self.windows.close()
		self.windows.close()
		assert not self.windows.visible