예제 #1
0
    def testRemoveSubWindow(self):
        app = TestApp()
        app.init()
        subWindow = Window("Sub window")
        mainWindow = app.getMainWindow()
        mainWindow.addWindow(subWindow)

        # Added to main window so the parent of the sub window should be the
        # main window
        self.assertEquals(subWindow.getParent(), mainWindow)

        # Remove from the wrong window, should result in an exception
        removed = subWindow.removeWindow(subWindow)
        self.assertFalse(removed, "Window was removed even though it should " "not have been")

        # Parent should still be set
        self.assertEquals(subWindow.getParent(), mainWindow)

        # Remove from the main window and assert it has been removed
        removed = mainWindow.removeWindow(subWindow)
        self.assertTrue(removed, "Window was not removed correctly")
        self.assertEquals(subWindow.getParent(), None)
예제 #2
0
    def testRemoveSubWindow(self):
        app = TestApp()
        app.init()
        subWindow = Window('Sub window')
        mainWindow = app.getMainWindow()
        mainWindow.addWindow(subWindow)

        # Added to main window so the parent of the sub window should be the
        # main window
        self.assertEquals(subWindow.getParent(), mainWindow)

        # Remove from the wrong window, should result in an exception
        removed = subWindow.removeWindow(subWindow)
        self.assertFalse(
            removed, 'Window was removed even though it should '
            'not have been')

        # Parent should still be set
        self.assertEquals(subWindow.getParent(), mainWindow)

        # Remove from the main window and assert it has been removed
        removed = mainWindow.removeWindow(subWindow)
        self.assertTrue(removed, 'Window was not removed correctly')
        self.assertEquals(subWindow.getParent(), None)