Commit aa0e7f28 authored by Miko Mynttinen's avatar Miko Mynttinen
Browse files

Bug 1730856 - Part 2: Add test. r=mstange

parent 6e6f9c75
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Hit-testing of fixed background image</title>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <style>
      html,
      body {
        height: 100vh;
        margin: 0px;
        padding: 0px;
        overflow-x: hidden;
      }
      .bg-gradient {
        background: linear-gradient(white, green) fixed;
        height: 1000px;
        width: 100%;
      }
  </style>
  </head>
  <body>
    <div class="bg-gradient"></div>
    <div style="height: 1000px; background-color: green;"></div>
  </body>
<script type="application/javascript">

async function test() {
  var config = getHitTestConfig();
  var utils = config.utils;

  var body = document.querySelector("body");
  utils.setDisplayPortForElement(0, 0, 800, 2000, body, 1);
  await promiseApzFlushedRepaints();

  var target = document.querySelector(".bg-gradient");
  checkHitResult(hitTest(centerOf(target)),
                 APZHitResultFlags.VISIBLE,
                 utils.getViewId(body),
                 utils.getLayersId(),
                 "fixed bg image");
}

waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);

</script>
</html>
</html>
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ var subtests = [
  {"file": "helper_hittest_overscroll_contextmenu.html", "prefs": overscroll_prefs},
  {"file": "helper_hittest_bug1715187.html", "prefs": prefs},
  {"file": "helper_hittest_bug1715369.html", "prefs": prefs},
  {"file": "helper_hittest_fixed_bg.html", "prefs": prefs},
  // This test should be at the end, because it's prone to timeout.
  {"file": "helper_hittest_spam.html", "prefs": prefs},
];