Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  test_device_reset.html   Sprache: HTML

 
 products/sources/formale Sprachen/C/Firefox/gfx/tests/chrome/test_device_reset.html


<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1274663
-->

  <head>
    <meta charset="utf-8">
    <title>Test device reset</title>
    <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
  </head>
  <body>
    <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1274663">Mozilla Bug 1274663</a>
    <script>
      var importObj = {};

      var windows = SpecialPowers.Services.ww.getWindowEnumerator();
      var windowutils;
      while (windows.hasMoreElements()) {
        windowutils = windows.getNext().windowUtils;
      }

      const PAGE_WIDTH = 200;
      const PAGE_HEIGHT = 200;

      // Helper functions

      function testCompositor(ctx) {
        takeWindowSnapshot(ctx);
        var testPassed = true;

        if (!verifyCanvasRendering(ctx)) {
          testPassed = false;
        }

        return testPassed;
      }

      function testPixel(ctx, x, y, r, g, b, a, fuzz) {
        var data = ctx.getImageData(x, y, 1, 1);

        if (Math.abs(data.data[0] - r) <= fuzz &&
            Math.abs(data.data[1] - g) <= fuzz &&
            Math.abs(data.data[2] - b) <= fuzz &&
            Math.abs(data.data[3] - a) <= fuzz) {
          return true;
        }
        return false;
      }

      function verifyCanvasRendering(ctx) {
        return testPixel(ctx, 20, 20, 140, 25, 86, 255, 0);
      }

      function takeWindowSnapshot(ctx) {
        var flags = ctx.DRAWWINDOW_DRAW_CARET | ctx.DRAWWINDOW_DRAW_VIEW | ctx.DRAWWINDOW_USE_WIDGET_LAYERS;
        ctx.drawWindow(window, 0, 0, PAGE_WIDTH, PAGE_HEIGHT, "rgb(140,25,86)", flags);
      }

      function createCanvas() {
        let canvas = document.createElementNS("http://www.w3.org/1999/xhtml""canvas");

        canvas.setAttribute("width", PAGE_WIDTH + "px");
        canvas.setAttribute("height", PAGE_HEIGHT + "px");

        return canvas;
      }

      // Test runner code
      windowutils.triggerDeviceReset();

      SimpleTest.waitForExplicitFinish();
      window.addEventListener("MozAfterPaint", function paintHandle() {
         // Add more latency before calling runCanvasTest()
         // runCanvasTest() needs to be called after gecko's device reset handling.
         // Since Bug 1757879 fix, the triggerDeviceReset() does the device reset
         // handling asynchronously.
         window.requestAnimationFrame(() => {
           runCanvasTest();
        });
        window.removeEventListener("MozAfterPaint", paintHandle);
      });

      function runCanvasTest() {
        const canvas = createCanvas();
        const ctx = canvas.getContext("2d");
        document.body.appendChild(canvas);

        ok(testCompositor(ctx), "Canvas did not get rendered after device reset");
        SimpleTest.finish();
      }
    </script>
  </body>
</html>

Messung V0.5
C=99 H=100 G=99

¤ Dauer der Verarbeitung: 0.24 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge