Пример #1
0
  @Test
  public void testIsValidScreenSize() {
    final Dimension currentSize = HelperScreen.getCurrentScreenSize();

    assertTrue(HelperScreen.isValidScreenSize(currentSize));
    assertTrue(
        HelperScreen.isValidScreenSize(
            new Dimension(currentSize.width - 10, currentSize.height - 10)));
    assertFalse(
        HelperScreen.isValidScreenSize(
            new Dimension(currentSize.width + 10, currentSize.height + 10)));
    assertTrue(
        HelperScreen.isValidScreenSize(new Dimension(currentSize.width, currentSize.height - 10)));
    assertFalse(
        HelperScreen.isValidScreenSize(new Dimension(currentSize.width, currentSize.height + 10)));
    assertTrue(
        HelperScreen.isValidScreenSize(new Dimension(currentSize.width - 10, currentSize.height)));
    assertFalse(
        HelperScreen.isValidScreenSize(new Dimension(currentSize.width + 10, currentSize.height)));

    try {
      HelperScreen.isValidScreenSize(null);
      fail("minSize is null"); // $NON-NLS-1$
    } catch (RuntimeExceptionIsNull ex) {
      // nothing to do
    } catch (Exception ex) {
      fail(ex.getMessage());
    }
  }
Пример #2
0
 @Test
 public void testGetCurrentScreenSize() {
   assertEquals(Toolkit.getDefaultToolkit().getScreenSize(), HelperScreen.getCurrentScreenSize());
 }