< prev index next >

functional/ControlsTests/test/javafx/scene/control/test/util/UtilTestFunctions.java

Print this page




  71 import org.jemmy.action.GetAction;
  72 import org.jemmy.control.Wrap;
  73 import org.jemmy.env.Timeout;
  74 import org.jemmy.fx.ByID;
  75 import org.jemmy.fx.NodeWrap;
  76 import org.jemmy.fx.Root;
  77 import org.jemmy.fx.control.TabPaneDock;
  78 import static org.jemmy.fx.control.TextControlWrap.SELECTED_PROP_NAME;
  79 import org.jemmy.input.AbstractScroll;
  80 import org.jemmy.interfaces.Keyboard.KeyboardModifiers;
  81 import org.jemmy.interfaces.Parent;
  82 import org.jemmy.interfaces.Selectable;
  83 import org.jemmy.interfaces.Text;
  84 import org.jemmy.lookup.LookupCriteria;
  85 import org.jemmy.timing.State;
  86 import org.jemmy.timing.Waiter;
  87 import static org.junit.Assert.*;
  88 import test.javaclient.shared.TestUtil;
  89 import test.javaclient.shared.Utils;
  90 


  91 /**
  92  * @author Alexander Kirov
  93  *
  94  * Used for many my tests. Don't touch it until you are sure, what you do.
  95  */
  96 public class UtilTestFunctions extends ControlsTestBase {
  97 
  98     protected static Parent<Node> parent;
  99     protected static KeyboardModifiers CTRL_DOWN_MASK_OS;
 100     protected static ChangingController defaultController;
 101     protected static final int ITERATIONS = 3;
 102     protected static final int SLEEP = 300;
 103     protected static double ASSERT_CMP_PRECISION = 3.5;
 104     protected static SettingOption currentSettingOption = SettingOption.PROGRAM;
 105     private static Parent<Node> propertiesTableScrollPane = null;
 106     private static final boolean useCaching = true;
 107     private static String currentTabName = AbstractApplicationPropertiesRegystry.DEFAULT_DOMAIN_NAME;
 108     private static final String CUSTOM_STYLE_CONST = "imagescomparator/custom_font.css";
 109     private String rememberedStylesheet;
 110 


 798         //boolean direct, boolean inertia, double deltaX, double deltaY, double gestureDeltaX, double gestureDeltaY,
 799         //ScrollEvent.HorizontalTextScrollUnits textDeltaXUnits, double textDeltaX,
 800         //ScrollEvent.VerticalTextScrollUnits textDeltaYUnits, double textDeltaY, int touchCount)
 801         final ScrollEvent scrollEvent = new ScrollEvent(ScrollEvent.SCROLL,
 802                 _x, _y, _screenX, _screenY,
 803                 false, false, false, false,
 804                 false, false, _scrollX, _scrollY, 0, 0,
 805                 _scrollTextXUnits, _scrollTextX,
 806                 _scrollTextYUnits, _scrollTextY, 0, null /* PickResult?*/);
 807 
 808         wrap.getEnvironment().getExecutor().execute(wrap.getEnvironment(), true, new Action() {
 809             @Override
 810             public void run(Object... os) throws Exception {
 811                 Wrap<? extends Node> wrap = ((Wrap<? extends Node>) os[2]);
 812                 Point2D pointOnScene = new GetAction<Point2D>() {
 813                     @Override
 814                     public void run(Object... os) throws Exception {
 815                         setResult(((Node) os[0]).localToScene((Double) os[1], (Double) os[2]));
 816                     }
 817                 }.dispatch(Root.ROOT.getEnvironment(), wrap.getControl(), Double.valueOf(wrap.getScreenBounds().width / 4), Double.valueOf(wrap.getScreenBounds().height / 4));


 818                 final PickResultChooser result = new PickResultChooser();
 819 

 820                 //public PickRay(Vec3d origin, Vec3d direction, double nearClip, double farClip) {
 821                 (((Wrap<? extends Scene>) os[0]).getControl()).getRoot().impl_pickNode(new PickRay(new Vec3d(pointOnScene.getX(), pointOnScene.getY(), -10), new Vec3d(0, 0, 1), 1.0, 100), result);



 822                 Node node = result.getIntersectedNode();
 823                 node.fireEvent(scrollEvent);
 824             }
 825         }, scene, scrollEvent, wrap);
 826     }
 827 
 828     protected static void switchOnBinding(SettingType type, Enum propType) {
 829         if (!getToggleButtonState(getPrefix(type) + propType.toString().toUpperCase() + BIND_BUTTON_SUFFIX)) {
 830             changePropertyControlBindingToggleButtonState(type, propType);
 831         }
 832     }
 833 
 834     protected static void switchOffBinding(SettingType type, Enum propType) {
 835         if (getToggleButtonState(getPrefix(type) + propType.toString().toUpperCase() + BIND_BUTTON_SUFFIX)) {
 836             changePropertyControlBindingToggleButtonState(type, propType);
 837         }
 838     }
 839 
 840     private static boolean getToggleButtonState(String controlID) {
 841         final ToggleButton tb = findToggleButton(controlID).getControl();




  71 import org.jemmy.action.GetAction;
  72 import org.jemmy.control.Wrap;
  73 import org.jemmy.env.Timeout;
  74 import org.jemmy.fx.ByID;
  75 import org.jemmy.fx.NodeWrap;
  76 import org.jemmy.fx.Root;
  77 import org.jemmy.fx.control.TabPaneDock;
  78 import static org.jemmy.fx.control.TextControlWrap.SELECTED_PROP_NAME;
  79 import org.jemmy.input.AbstractScroll;
  80 import org.jemmy.interfaces.Keyboard.KeyboardModifiers;
  81 import org.jemmy.interfaces.Parent;
  82 import org.jemmy.interfaces.Selectable;
  83 import org.jemmy.interfaces.Text;
  84 import org.jemmy.lookup.LookupCriteria;
  85 import org.jemmy.timing.State;
  86 import org.jemmy.timing.Waiter;
  87 import static org.junit.Assert.*;
  88 import test.javaclient.shared.TestUtil;
  89 import test.javaclient.shared.Utils;
  90 
  91 import com.sun.javafx.scene.NodeHelper;
  92 
  93 /**
  94  * @author Alexander Kirov
  95  *
  96  * Used for many my tests. Don't touch it until you are sure, what you do.
  97  */
  98 public class UtilTestFunctions extends ControlsTestBase {
  99 
 100     protected static Parent<Node> parent;
 101     protected static KeyboardModifiers CTRL_DOWN_MASK_OS;
 102     protected static ChangingController defaultController;
 103     protected static final int ITERATIONS = 3;
 104     protected static final int SLEEP = 300;
 105     protected static double ASSERT_CMP_PRECISION = 3.5;
 106     protected static SettingOption currentSettingOption = SettingOption.PROGRAM;
 107     private static Parent<Node> propertiesTableScrollPane = null;
 108     private static final boolean useCaching = true;
 109     private static String currentTabName = AbstractApplicationPropertiesRegystry.DEFAULT_DOMAIN_NAME;
 110     private static final String CUSTOM_STYLE_CONST = "imagescomparator/custom_font.css";
 111     private String rememberedStylesheet;
 112 


 800         //boolean direct, boolean inertia, double deltaX, double deltaY, double gestureDeltaX, double gestureDeltaY,
 801         //ScrollEvent.HorizontalTextScrollUnits textDeltaXUnits, double textDeltaX,
 802         //ScrollEvent.VerticalTextScrollUnits textDeltaYUnits, double textDeltaY, int touchCount)
 803         final ScrollEvent scrollEvent = new ScrollEvent(ScrollEvent.SCROLL,
 804                 _x, _y, _screenX, _screenY,
 805                 false, false, false, false,
 806                 false, false, _scrollX, _scrollY, 0, 0,
 807                 _scrollTextXUnits, _scrollTextX,
 808                 _scrollTextYUnits, _scrollTextY, 0, null /* PickResult?*/);
 809 
 810         wrap.getEnvironment().getExecutor().execute(wrap.getEnvironment(), true, new Action() {
 811             @Override
 812             public void run(Object... os) throws Exception {
 813                 Wrap<? extends Node> wrap = ((Wrap<? extends Node>) os[2]);
 814                 Point2D pointOnScene = new GetAction<Point2D>() {
 815                     @Override
 816                     public void run(Object... os) throws Exception {
 817                         setResult(((Node) os[0]).localToScene((Double) os[1], (Double) os[2]));
 818                     }
 819                 }.dispatch(Root.ROOT.getEnvironment(), wrap.getControl(), Double.valueOf(wrap.getScreenBounds().width / 4), Double.valueOf(wrap.getScreenBounds().height / 4));
 820 
 821                 // The following line requires --add-exports javafx.graphics/com.sun.javafx.scene.input=ALL-UNNAMED
 822                 final PickResultChooser result = new PickResultChooser();
 823 
 824                 // The following line requires --add-exports javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED
 825                 //public PickRay(Vec3d origin, Vec3d direction, double nearClip, double farClip) {
 826                 NodeHelper.pickNode(
 827                     (((Wrap<? extends Scene>) os[0]).getControl()).getRoot(),
 828                     new PickRay(new Vec3d(pointOnScene.getX(), pointOnScene.getY(), -10), new Vec3d(0, 0, 1), 1.0, 100),
 829                     result);
 830                 Node node = result.getIntersectedNode();
 831                 node.fireEvent(scrollEvent);
 832             }
 833         }, scene, scrollEvent, wrap);
 834     }
 835 
 836     protected static void switchOnBinding(SettingType type, Enum propType) {
 837         if (!getToggleButtonState(getPrefix(type) + propType.toString().toUpperCase() + BIND_BUTTON_SUFFIX)) {
 838             changePropertyControlBindingToggleButtonState(type, propType);
 839         }
 840     }
 841 
 842     protected static void switchOffBinding(SettingType type, Enum propType) {
 843         if (getToggleButtonState(getPrefix(type) + propType.toString().toUpperCase() + BIND_BUTTON_SUFFIX)) {
 844             changePropertyControlBindingToggleButtonState(type, propType);
 845         }
 846     }
 847 
 848     private static boolean getToggleButtonState(String controlID) {
 849         final ToggleButton tb = findToggleButton(controlID).getControl();


< prev index next >