150
151 public static void checkPageContentScreenshot(String name, boolean valuable_rect) {
152 try {
153 if (application.getNodeForScreenshot() == null) {
154 final Wrap<? extends Scene> scene = Root.ROOT.lookup(new ByWindowType(Stage.class)).lookup(Scene.class).wrap(0);
155
156 checkScreenshot(name, scene);
157 } else if (valuable_rect) {
158 checkScreenshot(name, getPageContent(), getPageContentSize());
159 } else {
160 checkScreenshot(name, getPageContent());
161 }
162 } catch (Throwable th) {
163 error(th);
164 }
165 }
166
167 public static Wrap<? extends Node> getPageContent() {
168 Node n = application.getNodeForScreenshot();
169 final Wrap<? extends Scene> scene = Root.ROOT.lookup(new ByWindowType(Stage.class)).lookup(Scene.class).wrap(0);
170 return new NodeDock(scene.as(Parent.class, Node.class), n.getId()).wrap();
171 }
172
173 /**
174 *
175 * @return rectangle contains all children of page content. This rectangle may have different
176 * size then size of Content.
177 */
178 public static Rectangle getPageContentSize() {
179 Node node = getPageContent().getControl();
180 Rectangle rect = new Rectangle();
181 if (node instanceof Pane) {
182 Pane p = (Pane) node;
183 for (Node n : p.getChildren()) {
184 rect.add((int) n.getBoundsInParent().getMaxX(), (int) n.getBoundsInParent().getMaxY());
185 }
186 } else {
187 rect.add((int) node.getBoundsInParent().getMaxX(), (int) node.getBoundsInParent().getMaxY());
188 }
189 return rect;
190 }
|
150
151 public static void checkPageContentScreenshot(String name, boolean valuable_rect) {
152 try {
153 if (application.getNodeForScreenshot() == null) {
154 final Wrap<? extends Scene> scene = Root.ROOT.lookup(new ByWindowType(Stage.class)).lookup(Scene.class).wrap(0);
155
156 checkScreenshot(name, scene);
157 } else if (valuable_rect) {
158 checkScreenshot(name, getPageContent(), getPageContentSize());
159 } else {
160 checkScreenshot(name, getPageContent());
161 }
162 } catch (Throwable th) {
163 error(th);
164 }
165 }
166
167 public static Wrap<? extends Node> getPageContent() {
168 Node n = application.getNodeForScreenshot();
169 final Wrap<? extends Scene> scene = Root.ROOT.lookup(new ByWindowType(Stage.class)).lookup(Scene.class).wrap(0);
170 //return new NodeDock(scene.as(Parent.class, Node.class), n.getId()).wrap();
171 return new NodeDock((Parent<Node>)scene.as(Parent.class, Node.class), n.getId()).wrap();
172 }
173
174 /**
175 *
176 * @return rectangle contains all children of page content. This rectangle may have different
177 * size then size of Content.
178 */
179 public static Rectangle getPageContentSize() {
180 Node node = getPageContent().getControl();
181 Rectangle rect = new Rectangle();
182 if (node instanceof Pane) {
183 Pane p = (Pane) node;
184 for (Node n : p.getChildren()) {
185 rect.add((int) n.getBoundsInParent().getMaxX(), (int) n.getBoundsInParent().getMaxY());
186 }
187 } else {
188 rect.add((int) node.getBoundsInParent().getMaxX(), (int) node.getBoundsInParent().getMaxY());
189 }
190 return rect;
191 }
|