/** Test {@link SitarWindow#getShell()}. */ @Test public void testEmptyShell() { Shell shell = new Shell(display); SitarWindow swtWindow = new SitarWindow(shell); assertEquals(swtWindow.getShell(), shell); }
/** Test {@link SitarWindow#isModal()} when it shouldn't be. */ @Test public void testShellIsModalFalse() { Shell shell = new Shell(display); SitarWindow swtWindow = new SitarWindow(shell); assertEquals(swtWindow.isModal(), false); }
/** Test {@link SitarWindow#isModal()}. */ @Test public void testShellIsModal() { Shell shell = new Shell(display, SWT.APPLICATION_MODAL); SitarWindow swtWindow = new SitarWindow(shell); assertEquals(swtWindow.isModal(), true); }
/** Test {@link SitarWindow#extractGUIProperties()}. */ @Test public void testExtractGUIProperties() { Shell shell1 = new Shell(display); SitarWindow window1 = new SitarWindow(shell1); window1.extractGUIProperties(); // this method never used, so don't bother verifying }
/** Test {@link SitarWindow#getGUIProperties()}. */ @Test public void testGetGUIProperties() { Shell shell1 = new Shell(display); SitarWindow window1 = new SitarWindow(shell1); window1.getGUIProperties(); // verified by integration tests }
/** Test {@link SitarWindow#isValid()} when shell isn't visible. */ @Test public void testShellIsValidFalse() { Shell shell = new Shell(display); shell.setText("ShellTitle"); shell.setVisible(false); SitarWindow swtWindow = new SitarWindow(shell); assertEquals(swtWindow.isValid(), false); }
/** Test {@link SitarWindow#getX()} and {@link SitarWindow#getY()}. */ @Test public void testShellLocation() { Shell shell = new Shell(display); shell.setLocation(1, 1); SitarWindow swtWindow = new SitarWindow(shell); assertEquals(swtWindow.getX(), 0); assertEquals(swtWindow.getY(), 0); }
/** Test {@link SitarWindow#getTitle()}. */ @Test public void testShellTitle() { Shell shell = new Shell(display); assertEquals(shell.getClass().getName(), new SitarWindow(shell).getTitle()); String shellTitle = "ShellTitle"; shell.setText(shellTitle); SitarWindow swtWindow = new SitarWindow(shell); assertEquals(shellTitle, swtWindow.getTitle()); }
/** Test {@link SitarWindow#equals(Object)}. */ @Test public void testEquals() { Shell shell1 = new Shell(display); SitarWindow window1 = new SitarWindow(shell1); assertTrue(window1.equals(window1)); assertFalse(window1.equals(shell1)); assertFalse(window1.equals(null)); Shell shell2 = new Shell(display); SitarWindow window2 = new SitarWindow(shell2); assertTrue(window1.equals(window2)); Shell shell3 = new Shell(display); shell3.setText("Window"); SitarWindow window3 = new SitarWindow(shell3); assertFalse(window1.equals(window3)); }