예제 #1
0
  @SmallTest
  @Feature({"Zoom test"})
  public void testZoomUsingMultiTouch() throws Throwable {
    XWalkSettings settings = getXWalkSettingsOnUiThreadByXWalkView(getXWalkView());
    loadDataSync(getZoomableHtml(0.5f), "text/html", false);

    assertTrue(settings.supportZoom());
    assertFalse(settings.getBuiltInZoomControls());
    assertFalse(settings.supportsMultiTouchZoomForTest());

    settings.setBuiltInZoomControls(true);
    assertTrue(settings.supportsMultiTouchZoomForTest());

    settings.setSupportZoom(false);
    assertFalse(settings.supportsMultiTouchZoomForTest());
  }
  @SmallTest
  public void testZoomUsingMultiTouch() {
    try {
      XWalkSettings settings = getXWalkSettingsOnUiThreadByXWalkView(getXWalkView());
      String url = "file:///android_asset/zoom.html";
      loadUrlSync(url);

      assertTrue(settings.supportZoom());
      assertFalse(settings.getBuiltInZoomControls());
      assertFalse(settings.supportsMultiTouchZoomForTest());

      settings.setBuiltInZoomControls(true);
      assertTrue(settings.supportsMultiTouchZoomForTest());

      settings.setSupportZoom(false);
      assertFalse(settings.supportsMultiTouchZoomForTest());
    } catch (Exception e) {
      assertTrue(false);
      e.printStackTrace();
    } catch (Throwable e) {
      assertTrue(false);
      e.printStackTrace();
    }
  }