|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| JScrollBarFixture | Line # 39 | 70 | 0% | 37 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | /* | |
| 2 | * Created on Dec 25, 2007 | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
| 5 | * in compliance with the License. You may obtain a copy of the License at | |
| 6 | * | |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 | * | |
| 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License | |
| 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
| 11 | * or implied. See the License for the specific language governing permissions and limitations under | |
| 12 | * the License. | |
| 13 | * | |
| 14 | * Copyright @2007-2010 the original author or authors. | |
| 15 | */ | |
| 16 | package org.fest.swing.fixture; | |
| 17 | ||
| 18 | import java.awt.Point; | |
| 19 | import java.util.regex.Pattern; | |
| 20 | ||
| 21 | import javax.swing.JScrollBar; | |
| 22 | ||
| 23 | import org.fest.swing.core.*; | |
| 24 | import org.fest.swing.driver.JScrollBarDriver; | |
| 25 | import org.fest.swing.exception.ComponentLookupException; | |
| 26 | import org.fest.swing.exception.WaitTimedOutError; | |
| 27 | import org.fest.swing.timing.Timeout; | |
| 28 | ||
| 29 | /** | |
| 30 | * Understands functional testing of <code>{@link JScrollBar}</code>s: | |
| 31 | * <ul> | |
| 32 | * <li>user input simulation</li> | |
| 33 | * <li>state verification</li> | |
| 34 | * <li>property value query</li> | |
| 35 | * </ul> | |
| 36 | * | |
| 37 | * @author Alex Ruiz | |
| 38 | */ | |
| 39 | public class JScrollBarFixture extends ComponentFixture<JScrollBar> implements CommonComponentFixture, | |
| 40 | JComponentFixture, JPopupMenuInvokerFixture { | |
| 41 | ||
| 42 | private JScrollBarDriver driver; | |
| 43 | ||
| 44 | /** | |
| 45 | * Creates a new <code>{@link JScrollBarFixture}</code>. | |
| 46 | * @param robot performs simulation of user events on the given <code>JScrollBar</code>. | |
| 47 | * @param target the <code>JScrollBar</code> to be managed by this fixture. | |
| 48 | * @throws NullPointerException if <code>robot</code> is <code>null</code>. | |
| 49 | * @throws NullPointerException if <code>target</code> is <code>null</code>. | |
| 50 | */ | |
| 51 | 40 |
public JScrollBarFixture(Robot robot, JScrollBar target) { |
| 52 | 40 | super(robot, target); |
| 53 | 40 | createDriver(); |
| 54 | } | |
| 55 | ||
| 56 | /** | |
| 57 | * Creates a new <code>{@link JScrollBarFixture}</code>. | |
| 58 | * @param robot performs simulation of user events on a <code>JScrollBar</code>. | |
| 59 | * @param scrollBarName the name of the <code>JScrollBar</code> to find using the given <code>Robot</code>. | |
| 60 | * @throws NullPointerException if <code>robot</code> is <code>null</code>. | |
| 61 | * @throws ComponentLookupException if a matching <code>JScrollBar</code> could not be found. | |
| 62 | * @throws ComponentLookupException if more than one matching <code>JScrollBar</code> is found. | |
| 63 | */ | |
| 64 | 1 |
public JScrollBarFixture(Robot robot, String scrollBarName) { |
| 65 | 1 | super(robot, scrollBarName, JScrollBar.class); |
| 66 | 1 | createDriver(); |
| 67 | } | |
| 68 | ||
| 69 | 41 |
private void createDriver() { |
| 70 | 41 | driver(new JScrollBarDriver(robot)); |
| 71 | } | |
| 72 | ||
| 73 | /** | |
| 74 | * Sets the <code>{@link JScrollBarDriver}</code> to be used by this fixture. | |
| 75 | * @param newDriver the new <code>JScrollBarDriver</code>. | |
| 76 | * @throws NullPointerException if the given driver is <code>null</code>. | |
| 77 | */ | |
| 78 | 75 |
protected final void driver(JScrollBarDriver newDriver) { |
| 79 | 75 | validateNotNull(newDriver); |
| 80 | 74 | driver = newDriver; |
| 81 | } | |
| 82 | ||
| 83 | /** | |
| 84 | * Simulates a user clicking this fixture's <code>{@link JScrollBar}</code>. | |
| 85 | * @return this fixture. | |
| 86 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 87 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 88 | */ | |
| 89 | 1 |
public JScrollBarFixture click() { |
| 90 | 1 | driver.click(target); |
| 91 | 1 | return this; |
| 92 | } | |
| 93 | ||
| 94 | /** | |
| 95 | * Simulates a user clicking this fixture's <code>{@link JScrollBar}</code>. | |
| 96 | * @param button the button to click. | |
| 97 | * @throws NullPointerException if the given <code>MouseButton</code> is <code>null</code>. | |
| 98 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 99 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 100 | * @return this fixture. | |
| 101 | */ | |
| 102 | 1 |
public JScrollBarFixture click(MouseButton button) { |
| 103 | 1 | driver.click(target, button); |
| 104 | 1 | return this; |
| 105 | } | |
| 106 | ||
| 107 | /** | |
| 108 | * Simulates a user clicking this fixture's <code>{@link JScrollBar}</code>. | |
| 109 | * @param mouseClickInfo specifies the button to click and the times the button should be clicked. | |
| 110 | * @return this fixture. | |
| 111 | * @throws NullPointerException if the given <code>MouseClickInfo</code> is <code>null</code>. | |
| 112 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 113 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 114 | */ | |
| 115 | 1 |
public JScrollBarFixture click(MouseClickInfo mouseClickInfo) { |
| 116 | 1 | driver.click(target, mouseClickInfo); |
| 117 | 1 | return this; |
| 118 | } | |
| 119 | ||
| 120 | /** | |
| 121 | * Simulates a user double-clicking this fixture's <code>{@link JScrollBar}</code>. | |
| 122 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 123 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 124 | * @return this fixture. | |
| 125 | */ | |
| 126 | 1 |
public JScrollBarFixture doubleClick() { |
| 127 | 1 | driver.doubleClick(target); |
| 128 | 1 | return this; |
| 129 | } | |
| 130 | ||
| 131 | /** | |
| 132 | * Simulates a user right-clicking this fixture's <code>{@link JScrollBar}</code>. | |
| 133 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 134 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 135 | * @return this fixture. | |
| 136 | */ | |
| 137 | 1 |
public JScrollBarFixture rightClick() { |
| 138 | 1 | driver.rightClick(target); |
| 139 | 1 | return this; |
| 140 | } | |
| 141 | ||
| 142 | /** | |
| 143 | * Gives input focus to this fixture's <code>{@link JScrollBar}</code>. | |
| 144 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 145 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 146 | * @return this fixture. | |
| 147 | */ | |
| 148 | 1 |
public JScrollBarFixture focus() { |
| 149 | 1 | driver.focus(target); |
| 150 | 1 | return this; |
| 151 | } | |
| 152 | ||
| 153 | /** | |
| 154 | * Simulates a user pressing given key with the given modifiers on this fixture's <code>{@link JScrollBar}</code>. | |
| 155 | * Modifiers is a mask from the available <code>{@link java.awt.event.InputEvent}</code> masks. | |
| 156 | * @param keyPressInfo specifies the key and modifiers to press. | |
| 157 | * @return this fixture. | |
| 158 | * @throws NullPointerException if the given <code>KeyPressInfo</code> is <code>null</code>. | |
| 159 | * @throws IllegalArgumentException if the given code is not a valid key code. | |
| 160 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 161 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 162 | * @see KeyPressInfo | |
| 163 | */ | |
| 164 | 1 |
public JScrollBarFixture pressAndReleaseKey(KeyPressInfo keyPressInfo) { |
| 165 | 1 | driver.pressAndReleaseKey(target, keyPressInfo); |
| 166 | 1 | return this; |
| 167 | } | |
| 168 | ||
| 169 | /** | |
| 170 | * Simulates a user pressing and releasing the given keys on the <code>{@link JScrollBar}</code> managed by this | |
| 171 | * fixture. | |
| 172 | * @param keyCodes one or more codes of the keys to press. | |
| 173 | * @return this fixture. | |
| 174 | * @throws NullPointerException if the given array of codes is <code>null</code>. | |
| 175 | * @throws IllegalArgumentException if any of the given code is not a valid key code. | |
| 176 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 177 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 178 | * @see java.awt.event.KeyEvent | |
| 179 | */ | |
| 180 | 1 |
public JScrollBarFixture pressAndReleaseKeys(int... keyCodes) { |
| 181 | 1 | driver.pressAndReleaseKeys(target, keyCodes); |
| 182 | 1 | return this; |
| 183 | } | |
| 184 | ||
| 185 | /** | |
| 186 | * Simulates a user pressing the given key on this fixture's <code>{@link JScrollBar}</code>. | |
| 187 | * @param keyCode the code of the key to press. | |
| 188 | * @return this fixture. | |
| 189 | * @throws IllegalArgumentException if any of the given code is not a valid key code. | |
| 190 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 191 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 192 | * @see java.awt.event.KeyEvent | |
| 193 | */ | |
| 194 | 1 |
public JScrollBarFixture pressKey(int keyCode) { |
| 195 | 1 | driver.pressKey(target, keyCode); |
| 196 | 1 | return this; |
| 197 | } | |
| 198 | ||
| 199 | /** | |
| 200 | * Simulates a user releasing the given key on this fixture's <code>{@link JScrollBar}</code>. | |
| 201 | * @param keyCode the code of the key to release. | |
| 202 | * @return this fixture. | |
| 203 | * @throws IllegalArgumentException if any of the given code is not a valid key code. | |
| 204 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 205 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 206 | * @see java.awt.event.KeyEvent | |
| 207 | */ | |
| 208 | 1 |
public JScrollBarFixture releaseKey(int keyCode) { |
| 209 | 1 | driver.releaseKey(target, keyCode); |
| 210 | 1 | return this; |
| 211 | } | |
| 212 | ||
| 213 | /** | |
| 214 | * Simulates a user scrolling down one block (usually a page.) | |
| 215 | * @return this fixture. | |
| 216 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 217 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 218 | */ | |
| 219 | 1 |
public JScrollBarFixture scrollBlockDown() { |
| 220 | 1 | driver.scrollBlockDown(target); |
| 221 | 1 | return this; |
| 222 | } | |
| 223 | ||
| 224 | /** | |
| 225 | * Simulates a user scrolling down one block (usually a page,) the given number of times. | |
| 226 | * @param times the number of times to scroll down one block. | |
| 227 | * @return this fixture. | |
| 228 | * @throws IllegalArgumentException if <code>times</code> is less than or equal to zero. | |
| 229 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 230 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 231 | */ | |
| 232 | 1 |
public JScrollBarFixture scrollBlockDown(int times) { |
| 233 | 1 | driver.scrollBlockDown(target, times); |
| 234 | 1 | return this; |
| 235 | } | |
| 236 | ||
| 237 | /** | |
| 238 | * Simulates a user scrolling up one block (usually a page.) | |
| 239 | * @return this fixture. | |
| 240 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 241 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 242 | */ | |
| 243 | 1 |
public JScrollBarFixture scrollBlockUp() { |
| 244 | 1 | driver.scrollBlockUp(target); |
| 245 | 1 | return this; |
| 246 | } | |
| 247 | ||
| 248 | /** | |
| 249 | * Simulates a user scrolling up one block (usually a page,) the given number of times. | |
| 250 | * @param times the number of times to scroll up one block. | |
| 251 | * @return this fixture. | |
| 252 | * @throws IllegalArgumentException if <code>times</code> is less than or equal to zero. | |
| 253 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 254 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 255 | */ | |
| 256 | 1 |
public JScrollBarFixture scrollBlockUp(int times) { |
| 257 | 1 | driver.scrollBlockUp(target, times); |
| 258 | 1 | return this; |
| 259 | } | |
| 260 | ||
| 261 | /** | |
| 262 | * Simulates a user scrolling to the given position. | |
| 263 | * @param position the position to scroll to. | |
| 264 | * @return this fixture. | |
| 265 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 266 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 267 | * @throws IllegalArgumentException if the given position is not within the <code>JScrollBar</code> bounds. | |
| 268 | */ | |
| 269 | 1 |
public JScrollBarFixture scrollTo(int position) { |
| 270 | 1 | driver.scrollTo(target, position); |
| 271 | 1 | return this; |
| 272 | } | |
| 273 | ||
| 274 | /** | |
| 275 | * Simulates a user scrolling to the maximum position of this fixture's <code>{@link JScrollBar}</code>. | |
| 276 | * @return this fixture. | |
| 277 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 278 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 279 | */ | |
| 280 | 2 |
public JScrollBarFixture scrollToMaximum() { |
| 281 | 2 | driver.scrollToMaximum(target); |
| 282 | 2 | return this; |
| 283 | } | |
| 284 | ||
| 285 | /** | |
| 286 | * Simulates a user scrolling to the minimum position of this fixture's <code>{@link JScrollBar}</code>. | |
| 287 | * @return this fixture. | |
| 288 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 289 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 290 | */ | |
| 291 | 1 |
public JScrollBarFixture scrollToMinimum() { |
| 292 | 1 | driver.scrollToMinimum(target); |
| 293 | 1 | return this; |
| 294 | } | |
| 295 | ||
| 296 | /** | |
| 297 | * Simulates a user scrolling down one unit (usually a line.) | |
| 298 | * @return this fixture. | |
| 299 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 300 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 301 | */ | |
| 302 | 1 |
public JScrollBarFixture scrollUnitDown() { |
| 303 | 1 | driver.scrollUnitDown(target); |
| 304 | 1 | return this; |
| 305 | } | |
| 306 | ||
| 307 | /** | |
| 308 | * Simulates a user scrolling down one unit (usually a line,) the given number of times. | |
| 309 | * @param times the number of times to scroll down one unit. | |
| 310 | * @return this fixture. | |
| 311 | * @throws IllegalArgumentException if <code>times</code> is less than or equal to zero. | |
| 312 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 313 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 314 | */ | |
| 315 | 1 |
public JScrollBarFixture scrollUnitDown(int times) { |
| 316 | 1 | driver.scrollUnitDown(target, times); |
| 317 | 1 | return this; |
| 318 | } | |
| 319 | ||
| 320 | /** | |
| 321 | * Simulates a user scrolling up one unit (usually a line.) | |
| 322 | * @return this fixture. | |
| 323 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 324 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 325 | */ | |
| 326 | 1 |
public JScrollBarFixture scrollUnitUp() { |
| 327 | 1 | driver.scrollUnitUp(target); |
| 328 | 1 | return this; |
| 329 | } | |
| 330 | ||
| 331 | /** | |
| 332 | * Simulates a user scrolling up one unit (usually a line,) the given number of times. | |
| 333 | * @param times the number of times to scroll up one unit. | |
| 334 | * @return this fixture. | |
| 335 | * @throws IllegalArgumentException if <code>times</code> is less than or equal to zero. | |
| 336 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 337 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 338 | */ | |
| 339 | 1 |
public JScrollBarFixture scrollUnitUp(int times) { |
| 340 | 1 | driver.scrollUnitUp(target, times); |
| 341 | 1 | return this; |
| 342 | } | |
| 343 | ||
| 344 | /** | |
| 345 | * Asserts that the value of this fixture's <code>{@link JScrollBar}</code> is equal to the given one. | |
| 346 | * @param value the expected value. | |
| 347 | * @return this fixture. | |
| 348 | * @throws AssertionError if the value of this fixture's <code>JScrollBar</code> is not equal to the given one. | |
| 349 | */ | |
| 350 | 1 |
public JScrollBarFixture requireValue(int value) { |
| 351 | 1 | driver.requireValue(target, value); |
| 352 | 1 | return this; |
| 353 | } | |
| 354 | ||
| 355 | /** | |
| 356 | * Asserts that this fixture's <code>{@link JScrollBar}</code> has input focus. | |
| 357 | * @return this fixture. | |
| 358 | * @throws AssertionError if this fixture's <code>JScrollBar</code> does not have input focus. | |
| 359 | */ | |
| 360 | 1 |
public JScrollBarFixture requireFocused() { |
| 361 | 1 | driver.requireFocused(target); |
| 362 | 1 | return this; |
| 363 | } | |
| 364 | ||
| 365 | /** | |
| 366 | * Asserts that this fixture's <code>{@link JScrollBar}</code> is enabled. | |
| 367 | * @return this fixture. | |
| 368 | * @throws AssertionError if this fixture's <code>JScrollBar</code> is disabled. | |
| 369 | */ | |
| 370 | 1 |
public JScrollBarFixture requireEnabled() { |
| 371 | 1 | driver.requireEnabled(target); |
| 372 | 1 | return this; |
| 373 | } | |
| 374 | ||
| 375 | /** | |
| 376 | * Asserts that this fixture's <code>{@link JScrollBar}</code> is enabled. | |
| 377 | * @param timeout the time this fixture will wait for the component to be enabled. | |
| 378 | * @return this fixture. | |
| 379 | * @throws WaitTimedOutError if this fixture's <code>JScrollBar</code> is never enabled. | |
| 380 | */ | |
| 381 | 1 |
public JScrollBarFixture requireEnabled(Timeout timeout) { |
| 382 | 1 | driver.requireEnabled(target, timeout); |
| 383 | 1 | return this; |
| 384 | } | |
| 385 | ||
| 386 | /** | |
| 387 | * Asserts that this fixture's <code>{@link JScrollBar}</code> is disabled. | |
| 388 | * @return this fixture. | |
| 389 | * @throws AssertionError if this fixture's <code>JScrollBar</code> is enabled. | |
| 390 | */ | |
| 391 | 1 |
public JScrollBarFixture requireDisabled() { |
| 392 | 1 | driver.requireDisabled(target); |
| 393 | 1 | return this; |
| 394 | } | |
| 395 | ||
| 396 | /** | |
| 397 | * Asserts that this fixture's <code>{@link JScrollBar}</code> is visible. | |
| 398 | * @return this fixture. | |
| 399 | * @throws AssertionError if this fixture's <code>JScrollBar</code> is not visible. | |
| 400 | */ | |
| 401 | 1 |
public JScrollBarFixture requireVisible() { |
| 402 | 1 | driver.requireVisible(target); |
| 403 | 1 | return this; |
| 404 | } | |
| 405 | ||
| 406 | /** | |
| 407 | * Asserts that this fixture's <code>{@link JScrollBar}</code> is not visible. | |
| 408 | * @return this fixture. | |
| 409 | * @throws AssertionError if this fixture's <code>JScrollBar</code> is visible. | |
| 410 | */ | |
| 411 | 1 |
public JScrollBarFixture requireNotVisible() { |
| 412 | 1 | driver.requireNotVisible(target); |
| 413 | 1 | return this; |
| 414 | } | |
| 415 | ||
| 416 | /** | |
| 417 | * Shows a pop-up menu using this fixture's <code>{@link JScrollBar}</code> as the invoker of the pop-up menu. | |
| 418 | * @return a fixture that manages the displayed pop-up menu. | |
| 419 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 420 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 421 | * @throws ComponentLookupException if a pop-up menu cannot be found. | |
| 422 | */ | |
| 423 | 1 |
public JPopupMenuFixture showPopupMenu() { |
| 424 | 1 | return new JPopupMenuFixture(robot, driver.invokePopupMenu(target)); |
| 425 | } | |
| 426 | ||
| 427 | /** | |
| 428 | * Shows a pop-up menu at the given point using this fixture's <code>{@link JScrollBar}</code> as the invoker of the | |
| 429 | * pop-up menu. | |
| 430 | * @param p the given point where to show the pop-up menu. | |
| 431 | * @return a fixture that manages the displayed pop-up menu. | |
| 432 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is disabled. | |
| 433 | * @throws IllegalStateException if this fixture's <code>JScrollBar</code> is not showing on the screen. | |
| 434 | * @throws ComponentLookupException if a pop-up menu cannot be found. | |
| 435 | */ | |
| 436 | 1 |
public JPopupMenuFixture showPopupMenuAt(Point p) { |
| 437 | 1 | return new JPopupMenuFixture(robot, driver.invokePopupMenu(target, p)); |
| 438 | } | |
| 439 | ||
| 440 | /** | |
| 441 | * Returns the client property stored in this fixture's <code>{@link JScrollBar}</code>, under the given key. | |
| 442 | * @param key the key to use to retrieve the client property. | |
| 443 | * @return the value of the client property stored under the given key, or <code>null</code> if the property was | |
| 444 | * not found. | |
| 445 | * @throws NullPointerException if the given key is <code>null</code>. | |
| 446 | * @since 1.2 | |
| 447 | */ | |
| 448 | 1 |
public Object clientProperty(Object key) { |
| 449 | 1 | return driver.clientProperty(target, key); |
| 450 | } | |
| 451 | ||
| 452 | /** | |
| 453 | * Asserts that the toolTip in this fixture's <code>{@link JScrollBar}</code> matches the given value. | |
| 454 | * @param expected the given value. It can be a regular expression. | |
| 455 | * @return this fixture. | |
| 456 | * @throws AssertionError if the toolTip in this fixture's <code>JScrollBar</code> does not match the given value. | |
| 457 | * @since 1.2 | |
| 458 | */ | |
| 459 | 1 |
public JScrollBarFixture requireToolTip(String expected) { |
| 460 | 1 | driver.requireToolTip(target, expected); |
| 461 | 1 | return this; |
| 462 | } | |
| 463 | ||
| 464 | /** | |
| 465 | * Asserts that the toolTip in this fixture's <code>{@link JScrollBar}</code> matches the given regular expression | |
| 466 | * pattern. | |
| 467 | * @param pattern the regular expression pattern to match. | |
| 468 | * @return this fixture. | |
| 469 | * @throws NullPointerException if the given regular expression pattern is <code>null</code>. | |
| 470 | * @throws AssertionError if the toolTip in this fixture's <code>JScrollBar</code> does not match the given regular | |
| 471 | * expression. | |
| 472 | * @since 1.2 | |
| 473 | */ | |
| 474 | 1 |
public JScrollBarFixture requireToolTip(Pattern pattern) { |
| 475 | 1 | driver.requireToolTip(target, pattern); |
| 476 | 1 | return this; |
| 477 | } | |
| 478 | } | |
|
||||||||||||