functional/ControlsTests/test/javafx/scene/control/test/Mnemonics/MnemonicsTestBase.java

Print this page




 106                     @Override
 107                     public void run(Object... os) throws Exception {
 108                         final Line control = underline_wrap.getControl();
 109                         setResult(control.getStroke().isOpaque() && control.isVisible() && (control.getOpacity() == 1.0));
 110                     }
 111                 }.dispatch(underline_wrap.getEnvironment());
 112             }
 113         }, exist);
 114         if (exist) {
 115             final Wrap<? extends Text> text_wrap = wrap.as(Parent.class, Node.class).lookup(Text.class).wrap();
 116             Rectangle text_bounds = text_wrap.getScreenBounds();
 117             final String str = text_wrap.as(org.jemmy.interfaces.Text.class).text();
 118             ArrayList<Rectangle> bounds_array = new ArrayList<Rectangle>();
 119             for (int i = 0; i < str.length() + 1; i++) {
 120                 bounds_array.add(null);
 121             }
 122             for (int y = 0; y < text_bounds.height; y++) {
 123                 for (int x = 0; x < text_bounds.width; x++) {
 124                     final Text control = text_wrap.getControl();
 125                     final int charIndex = new GetAction<Integer>() {
 126                         @Override
 127                         public void run(Object... os) throws Exception {
 128                             setResult(control.impl_hitTestChar(new Point2D((Integer)os[0], (Integer)os[1] - control.getBaselineOffset())).getCharIndex());
 129                         }
 130                     }.dispatch(wrap.getEnvironment(), x, y);
 131                     if (bounds_array.get(charIndex) == null) {
 132                         bounds_array.set(charIndex, new Rectangle(x, y, 0, 0));
 133                     } else  {
 134                         bounds_array.get(charIndex).add(x, y);
 135                     }
 136                 }
 137             }
 138             int underline_index = -1;
 139             if (wrap.is(org.jemmy.interfaces.Text.class)) {
 140                 underline_index = wrap.as(org.jemmy.interfaces.Text.class).text().indexOf("_");
 141             } else {
 142                 final Wrap<? extends Labeled> sub_wrap = wrap.as(Parent.class, Node.class).lookup(new LookupCriteria<Node>() {
 143                     public boolean check(Node cntrl) {
 144                         return cntrl instanceof Labeled;
 145                     }
 146                 }).wrap();
 147                 underline_index = sub_wrap.as(org.jemmy.interfaces.Text.class).text().indexOf("_");
 148             }


 106                     @Override
 107                     public void run(Object... os) throws Exception {
 108                         final Line control = underline_wrap.getControl();
 109                         setResult(control.getStroke().isOpaque() && control.isVisible() && (control.getOpacity() == 1.0));
 110                     }
 111                 }.dispatch(underline_wrap.getEnvironment());
 112             }
 113         }, exist);
 114         if (exist) {
 115             final Wrap<? extends Text> text_wrap = wrap.as(Parent.class, Node.class).lookup(Text.class).wrap();
 116             Rectangle text_bounds = text_wrap.getScreenBounds();
 117             final String str = text_wrap.as(org.jemmy.interfaces.Text.class).text();
 118             ArrayList<Rectangle> bounds_array = new ArrayList<Rectangle>();
 119             for (int i = 0; i < str.length() + 1; i++) {
 120                 bounds_array.add(null);
 121             }
 122             for (int y = 0; y < text_bounds.height; y++) {
 123                 for (int x = 0; x < text_bounds.width; x++) {
 124                     final Text control = text_wrap.getControl();
 125                     final int charIndex = new GetAction<Integer>() {

 126                         public void run(Object... os) throws Exception {
 127                             setResult(control.hitTest(new Point2D((Integer)os[0], (Integer)os[1] - control.getBaselineOffset())).getCharIndex());
 128                         }
 129                     }.dispatch(wrap.getEnvironment(), x, y);
 130                     if (bounds_array.get(charIndex) == null) {
 131                         bounds_array.set(charIndex, new Rectangle(x, y, 0, 0));
 132                     } else  {
 133                         bounds_array.get(charIndex).add(x, y);
 134                     }
 135                 }
 136             }
 137             int underline_index = -1;
 138             if (wrap.is(org.jemmy.interfaces.Text.class)) {
 139                 underline_index = wrap.as(org.jemmy.interfaces.Text.class).text().indexOf("_");
 140             } else {
 141                 final Wrap<? extends Labeled> sub_wrap = wrap.as(Parent.class, Node.class).lookup(new LookupCriteria<Node>() {
 142                     public boolean check(Node cntrl) {
 143                         return cntrl instanceof Labeled;
 144                     }
 145                 }).wrap();
 146                 underline_index = sub_wrap.as(org.jemmy.interfaces.Text.class).text().indexOf("_");
 147             }