Package com.opera.core.systems.model

Examples of com.opera.core.systems.model.ScreenCaptureReply


  }

  @Test
  @Ignore(platforms = MAC, value = "Needs investigation, doesn't return anything")
  public void realPng() {
    ScreenCaptureReply reply = driver.captureScreen();
    byte[] png = reply.getPng();

    assertTrue("PNG magic bytes match",
               png[0] == (byte) 0x89 &&
               png[1] == (byte) 0x50 &&
               png[2] == (byte) 0x4E &&
View Full Code Here


  /**
   * Tests the captureScreen method that returns a ScreenCaptureReply
   */
  @Test
  public void expectsScreenshotReply() {
    ScreenCaptureReply one = radioLittle.captureScreen();
    ScreenCaptureReply two = radioSome.captureScreen();

    assertEquals(one.getMd5(), two.getMd5());
    assertTrue("PNG data is the same", Arrays.equals(one.getPng(), two.getPng()));

    assertFalse(one.isBlank());
    assertFalse(two.isBlank());
  }
View Full Code Here

  }

  @Test
  public void saveScreenshot() {
    runner = new TestOperaLauncherRunner(settings);
    ScreenCaptureReply screenshot = runner.captureScreen();
    assertNotNull(screenshot);
  }
View Full Code Here

    ImmutableList.Builder<ColorResult> matches = ImmutableList.builder();
    for (ColorMatch match : result.getColorMatchListList()) {
      matches.add(new ColorResult(match.getId(), match.getCount()));
    }

    return new ScreenCaptureReply(result.getMd5(), matches.build());
  }
View Full Code Here

      builder.setIncludeImage(false);
    }

    ScreenWatcherResult result = executeScreenWatcher(builder, (int) timeout);

    return new ScreenCaptureReply(result.getMd5(), result.getPng().toByteArray());
  }
View Full Code Here

            return ScreenCapture.of();
          }
        });

    try {
      return new ScreenCaptureReply(capture.getMd5(), capture.getData());
    } catch (IOException e) {
      throw new OperaRunnerException("Unable to do screen capture: " + e.getMessage());
    }
  }
View Full Code Here

  public String saveScreenshot(String filename, long timeout, boolean includeImage,
                               List<String> hashes) {
    assertElementNotStale();

    Canvas canvas = buildCanvas();
    ScreenCaptureReply reply =
        exec.screenWatcher(canvas, timeout, includeImage, hashes);

    if (includeImage && reply.getPng() != null) {
      FileChannel stream;

      try {
        stream = new FileOutputStream(filename).getChannel();
        stream.write(ByteBuffer.wrap(reply.getPng()));
        stream.close();
      } catch (IOException e) {
        throw new WebDriverException("Failed to write file: " + e.getMessage(), e);
      }
    }

    return reply.getMd5();
  }
View Full Code Here

  @Deprecated
  public boolean containsColor(OperaColors... colors) {
    assertElementNotStale();

    Canvas canvas = buildCanvas();
    ScreenCaptureReply reply = exec.containsColor(canvas, 100L, colors);

    List<ColorResult> results = reply.getColorResults();

    for (ColorResult result : results) {
      if (result.getCount() > 0) {
        return true;
      }
View Full Code Here

TOP

Related Classes of com.opera.core.systems.model.ScreenCaptureReply

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.