--- a/toolkit/components/gfx/SanityTest.js
+++ b/toolkit/components/gfx/SanityTest.js
@@ -9,16 +9,20 @@ const { utils: Cu, interfaces: Ci, class
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const FRAME_SCRIPT_URL = "chrome://gfxsanity/content/gfxFrameScript.js";
const PAGE_WIDTH = 160;
const PAGE_HEIGHT = 234;
+const LEFT_EDGE = 8;
+const TOP_EDGE = 8;
+const CANVAS_WIDTH = 32;
+const CANVAS_HEIGHT = 64;
const DRIVER_PREF = "sanity-test.driver-version";
const DEVICE_PREF = "sanity-test.device-id";
const VERSION_PREF = "sanity-test.version";
const ADVANCED_LAYERS_PREF = "sanity-test.advanced-layers";
const DISABLE_VIDEO_PREF = "media.hardware-video-decoding.failed";
const RUNNING_PREF = "sanity-test.running";
const TIMEOUT_SEC = 20;
@@ -115,43 +119,45 @@ function takeWindowSnapshot(win, ctx) {
function verifyVideoRendering(ctx) {
return testPixel(ctx, 41, 105, 255, 255, 255, 255, 64) &&
testPixel(ctx, 107, 105, 0, 255, 0, 255, 64) &&
testPixel(ctx, 41, 171, 0, 0, 255, 255, 64) &&
testPixel(ctx, 107, 171, 255, 0, 0, 255, 64);
}
// Verify that the middle of the layers test is the color we expect.
-// It's a red 64x64 square, test a pixel deep into the 64x64 square
-// to prevent fuzzing.
+// It's a red CANVAS_WIDTHxCANVAS_HEIGHT square, test a pixel deep into the
+// square to prevent fuzzing, and another outside the expected limit of the
+// square to check that scaling occurred properly. The square is drawn LEFT_EDGE
+// pixels from the window's left edge and TOP_EDGE from the window's top edge.
function verifyLayersRendering(ctx) {
- return testPixel(ctx, 18, 18, 255, 0, 0, 255, 64);
+ return testPixel(ctx, LEFT_EDGE + CANVAS_WIDTH / 2, TOP_EDGE + CANVAS_HEIGHT / 2, 255, 0, 0, 255, 64) &&
+ testPixel(ctx, LEFT_EDGE + CANVAS_WIDTH, TOP_EDGE + CANVAS_HEIGHT / 2, 255, 255, 255, 255, 64);
}
function testCompositor(test, win, ctx) {
takeWindowSnapshot(win, ctx);
var testPassed = true;
- if (!verifyVideoRendering(ctx)) {
- reportResult(TEST_FAILED_VIDEO);
- Services.prefs.setBoolPref(DISABLE_VIDEO_PREF, true);
- testPassed = false;
- }
-
if (!verifyLayersRendering(ctx)) {
- // Try disabling advanced layers if it was enabled. Also trgiger
+ // Try disabling advanced layers if it was enabled. Also trigger
// a device reset so the screen redraws.
if (Services.prefs.getBoolPref(AL_ENABLED_PREF, false)) {
Services.prefs.setBoolPref(AL_TEST_FAILED_PREF, true);
test.utils.triggerDeviceReset();
}
reportResult(TEST_FAILED_RENDER);
testPassed = false;
} else {
Services.prefs.setBoolPref(AL_TEST_FAILED_PREF, false);
+ if (!verifyVideoRendering(ctx)) {
+ reportResult(TEST_FAILED_VIDEO);
+ Services.prefs.setBoolPref(DISABLE_VIDEO_PREF, true);
+ testPassed = false;
+ }
}
if (testPassed) {
reportResult(TEST_PASSED);
}
return testPassed;
}