functional/ControlsTests/test/javafx/scene/control/test/combobox/TestBase.java

Print this page




 228 
 229     protected void checkValue(String str) {
 230         assertEquals(str, getValue());
 231         checkTextFieldText(Properties.value, str);
 232     }
 233 
 234     //                  CHECKERS
 235     protected void checkEditable(boolean editable) {
 236         checkTextFieldText(Properties.editable, String.valueOf(editable));
 237         Assert.assertEquals(checkTextFieldVisibility(), editable);
 238     }
 239 
 240     protected void checkPopupShowing(boolean showing) throws InterruptedException {
 241         checkSimpleListenerValue(Properties.showing, String.valueOf(showing));
 242         Assert.assertEquals(isPopupVisible(), showing);
 243     }
 244 
 245     protected void checkScrollBarVisibility(boolean visible) throws InterruptedException {
 246         Wrap<? extends Scene> popup = getPopupWrap();
 247         if (popup != null) {
 248             Assert.assertTrue(findScrollBar(((Wrap<? extends ListView>) popup.as(Parent.class, Node.class).lookup(ListView.class).wrap()).as(Parent.class, Node.class), Orientation.VERTICAL, visible) != null);

 249         }
 250     }
 251 
 252     protected boolean checkTextFieldVisibility() {
 253         Parent<Node> parentWrap = testedControl.as(Parent.class, Node.class);
 254         LookupCriteria<Node> lc = new LookupCriteria<Node>() {
 255 
 256             public boolean check(Node cntrl) {
 257                 return cntrl instanceof TextField && cntrl.isVisible();
 258             }
 259         };
 260         return parentWrap.lookup(lc).size() != 0;
 261     }
 262 
 263     public void checkPopupCoordinates() {
 264         Wrap listViewWrap = getPopupWrap().as(Parent.class, Node.class).lookup(ListView.class).wrap();
 265         assertEquals(listViewWrap.getScreenBounds().x, testedControl.getScreenBounds().x, 2);
 266         assertEquals(listViewWrap.getScreenBounds().y, testedControl.getScreenBounds().y + testedControl.getScreenBounds().height, 2);
 267     }
 268 


 228 
 229     protected void checkValue(String str) {
 230         assertEquals(str, getValue());
 231         checkTextFieldText(Properties.value, str);
 232     }
 233 
 234     //                  CHECKERS
 235     protected void checkEditable(boolean editable) {
 236         checkTextFieldText(Properties.editable, String.valueOf(editable));
 237         Assert.assertEquals(checkTextFieldVisibility(), editable);
 238     }
 239 
 240     protected void checkPopupShowing(boolean showing) throws InterruptedException {
 241         checkSimpleListenerValue(Properties.showing, String.valueOf(showing));
 242         Assert.assertEquals(isPopupVisible(), showing);
 243     }
 244 
 245     protected void checkScrollBarVisibility(boolean visible) throws InterruptedException {
 246         Wrap<? extends Scene> popup = getPopupWrap();
 247         if (popup != null) {
 248             Assert.assertTrue(findScrollBar(((Parent<Node>) ((Wrap<? extends ListView>) ((Parent<Node>) popup.as(Parent.class, Node.class))
 249                     .lookup(ListView.class).wrap()).as(Parent.class, Node.class)), Orientation.VERTICAL, visible) != null);
 250         }
 251     }
 252 
 253     protected boolean checkTextFieldVisibility() {
 254         Parent<Node> parentWrap = testedControl.as(Parent.class, Node.class);
 255         LookupCriteria<Node> lc = new LookupCriteria<Node>() {
 256 
 257             public boolean check(Node cntrl) {
 258                 return cntrl instanceof TextField && cntrl.isVisible();
 259             }
 260         };
 261         return parentWrap.lookup(lc).size() != 0;
 262     }
 263 
 264     public void checkPopupCoordinates() {
 265         Wrap listViewWrap = getPopupWrap().as(Parent.class, Node.class).lookup(ListView.class).wrap();
 266         assertEquals(listViewWrap.getScreenBounds().x, testedControl.getScreenBounds().x, 2);
 267         assertEquals(listViewWrap.getScreenBounds().y, testedControl.getScreenBounds().y + testedControl.getScreenBounds().height, 2);
 268     }
 269