Package org.openqa.selenium

Examples of org.openqa.selenium.Dimension


  @Test
  public void equality() {
    OperaMobileEmulation.Builder builder = OperaMobileEmulation.builder();

    builder.setResolution(new Dimension(100, 200));
    builder.setPPI(300);
    builder.setProfileName("hoobaflooba");
    builder.setIME(EmulationProfile.IME.KEYPAD);
    builder.setUserAgent(OperaMobileEmulation.UserAgent.MEEGO);

    EmulationProfile profile = builder.build();

    EmulationProfile expectedProfile = new EmulationProfile() {
      public String getProfileName() {
        return "hoobaflooba";
      }

      public Dimension getResolution() {
        return new Dimension(100, 200);
      }

      public int getPPI() {
        return 300;
      }
View Full Code Here


                 OperaMobileEmulation.builder().setHeight(123).build().getResolution().getHeight());
  }

  @Test
  public void builderShorthandResolution() {
    assertEquals(new Dimension(100, 200),
                 OperaMobileEmulation.builder().setResolution(100, 200).build().getResolution());
  }
View Full Code Here

  @Test
  public void defaultsAreCorrect() {
    EmulationProfile profile = OperaMobileEmulation.builder().build();

    assertEquals(null, profile.getProfileName());
    assertEquals(new Dimension(480, 800), profile.getResolution());
    assertEquals(233, profile.getPPI());
    assertEquals(EmulationProfile.IME.TOUCH, profile.getIME());
    assertEquals(OperaMobileEmulation.UserAgent.ANDROID.toString(), profile.getUserAgent());
  }
View Full Code Here

    json.put("userAgent", "MeeGo");

    EmulationProfile profile = OperaMobileEmulation.fromJson(json);

    assertEquals("hoobaflooba", profile.getProfileName());
    assertEquals(new Dimension(100, 200), profile.getResolution());
    assertEquals(300, profile.getPPI());
    assertEquals(EmulationProfile.IME.TABLET, profile.getIME());
    assertEquals(OperaMobileEmulation.UserAgent.MEEGO.toString(), profile.getUserAgent());
  }
View Full Code Here

    String widthAndHeight =
        debugger.callFunctionOnObject("var s=" + OperaAtom.GET_SIZE
                                      + "(locator);return s.width+','+s.height;", objectId);

    String[] dimension = widthAndHeight.split(",");
    return new Dimension(Integer.valueOf(dimension[0]), Integer.valueOf(dimension[1]));
  }
View Full Code Here

   *
   * @return a canvas representing the size and position of this element.
   */
  private Canvas buildCanvas() {
    Canvas canvas = new Canvas();
    Dimension dimension = getSize();
    Point point = coordinates.inViewPort();
    int x = point.x;
    int y = point.y;

    // Avoid internal error by making sure we have some width and height
View Full Code Here

     * @param width  the width of the screen
     * @param height the height of the screen
     * @return self-reference
     */
    public Builder setResolution(int width, int height) {
      setResolution(new Dimension(width, height));
      return this;
    }
View Full Code Here

     *
     * @param width the width of the screen
     * @return self-reference
     */
    public Builder setWidth(int width) {
      setResolution(new Dimension(width, config.getResolution().getHeight()));
      return this;
    }
View Full Code Here

     *
     * @param height the height of the screen
     * @return self-reference
     */
    public Builder setHeight(int height) {
      setResolution(new Dimension(config.getResolution().getWidth(), height));
      return this;
    }
View Full Code Here

   */
  public void emulate(EmulationProfile profile) {
    options.get(EMULATION_PROFILE).setValue(profile);

    if (profile != null) {
      Dimension resolution = profile.getResolution();
      arguments().add("-windowsize",
                      String.format("%dx%d", resolution.getWidth(), resolution.getHeight()));
      arguments().add(new OperaArgument("-ppi", profile.getPPI()));
      if (profile.getIME() == EmulationProfile.IME.KEYPAD) {
        arguments().add("-notouchwithtouchevents");
      } else if (profile.getIME() == EmulationProfile.IME.TABLET) {
        arguments().add(new OperaArgument("-tabletui"));
View Full Code Here

TOP

Related Classes of org.openqa.selenium.Dimension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.