jdk/test/java/awt/Modal/helpers/TestWindow.java
changeset 25759 625be49758c1
parent 25202 a617d3450e3e
child 26014 e50160ba221c
equal deleted inserted replaced
25758:7b1757bad3fa 25759:625be49758c1
   293         assertTrue(closeGained.flag(),
   293         assertTrue(closeGained.flag(),
   294             "Tab navigation did not happen properly on Window. First " +
   294             "Tab navigation did not happen properly on Window. First " +
   295             "button did not gain focus on tab press. " + message);
   295             "button did not gain focus on tab press. " + message);
   296     }
   296     }
   297 
   297 
   298     public void checkCloseButtonFocusGained() {
   298     public void checkCloseButtonFocusGained(boolean refState) {
   299         checkCloseButtonFocusGained(Flag.ATTEMPTS);
   299         checkCloseButtonFocusGained(refState, Flag.ATTEMPTS);
   300     }
   300     }
   301 
   301 
   302     public void checkCloseButtonFocusGained(int attempts) {
   302     public void checkCloseButtonFocusGained(boolean refState, int attempts) {
   303         try {
   303         try {
   304             closeGained.waitForFlagTriggered(attempts);
   304             closeGained.waitForFlagTriggered(attempts);
   305         } catch (InterruptedException e) {}
   305         } catch (InterruptedException e) {}
   306         assertTrue(closeGained.flag(),
   306 
   307             "window Close button did not gain focus");
   307         String msg = "window Close button ";
   308     }
   308         msg += (refState ? "did not gain focus" :
   309 
   309                 "gained focus when it should not");
   310     public void checkOpenButtonFocusGained() {
   310 
   311         checkOpenButtonFocusGained(Flag.ATTEMPTS);
   311         assertTrue(closeGained.flag() == refState, msg);
   312     }
   312     }
   313 
   313 
   314     public void checkOpenButtonFocusGained(int attempts) {
   314 
       
   315     public void checkOpenButtonFocusGained(boolean refState) {
       
   316         checkOpenButtonFocusGained(refState, Flag.ATTEMPTS);
       
   317     }
       
   318 
       
   319     public void checkOpenButtonFocusGained(boolean refState, int attempts) {
   315         try {
   320         try {
   316             openGained.waitForFlagTriggered(attempts);
   321             openGained.waitForFlagTriggered(attempts);
   317         } catch (InterruptedException e) {}
   322         } catch (InterruptedException e) {}
   318         assertTrue(openGained.flag(),
   323 
   319             "window Open button did not gain focus");
   324         String msg = "window Open button ";
   320     }
   325         msg += (refState ? "did not gain focus" :
   321 
   326                 "gained focus when it should not");
   322     public void checkOpenButtonFocusLost() {
   327 
   323         checkOpenButtonFocusLost(Flag.ATTEMPTS);
   328         assertTrue(openGained.flag() == refState, msg);
   324     }
   329     }
   325 
   330 
   326     public void checkOpenButtonFocusLost(int attempts) {
   331     public void checkOpenButtonFocusLost(boolean refState) {
       
   332         checkOpenButtonFocusLost(refState, Flag.ATTEMPTS);
       
   333     }
       
   334 
       
   335     public void checkOpenButtonFocusLost(boolean refState, int attempts) {
   327         try {
   336         try {
   328             openLost.waitForFlagTriggered(attempts);
   337             openLost.waitForFlagTriggered(attempts);
   329         } catch (InterruptedException e) {}
   338         } catch (InterruptedException e) {}
   330         assertTrue(openLost.flag(),
   339 
   331             "window Open button did not lose focus");
   340         String msg = "window Open button ";
       
   341         msg += (refState ? "did not lose focus" :
       
   342                 "lost focus when it should not");
       
   343         assertTrue(openLost.flag()== refState, msg);
   332     }
   344     }
   333 }
   345 }