Bug 1392143 - P6. Use constants in coordinate calculations. r=mattwoodrow

This shows how the coordinates were actually calculated. and will make it easier should the video size needs to ever be changed again.

MozReview-Commit-ID: KkQNqz00Aw0

--HG--
extra : rebase_source : fb1074a28f2045c3889acc43fbe9c01dadc34a70
This commit is contained in:
Jean-Yves Avenard 2017-09-07 19:36:20 +02:00
Родитель 0c1d650052
Коммит 30d3f01b85
1 изменённых файлов: 11 добавлений и 10 удалений

Просмотреть файл

@ -18,7 +18,10 @@ const LEFT_EDGE = 8;
const TOP_EDGE = 8;
const CANVAS_WIDTH = 32;
const CANVAS_HEIGHT = 64;
// If those values are ever changed, make sure to update
// WMFVideoMFTManager::CanUseDXVA accordingly.
const VIDEO_WIDTH = 132;
const VIDEO_HEIGHT = 132;
const DRIVER_PREF = "sanity-test.driver-version";
const DEVICE_PREF = "sanity-test.device-id";
const VERSION_PREF = "sanity-test.version";
@ -107,21 +110,19 @@ function takeWindowSnapshot(win, ctx) {
// render as expected (with a tolerance of 64 to allow for
// yuv->rgb differences between platforms).
//
// The video is 132*132, and is split into quadrants of
// different colours. The top left of the video is 8,72
// and we test a pixel 33,33 into each quadrant to avoid
// The video is VIDEO_WIDTH*VIDEO_HEIGHT, and is split into quadrants of
// different colours. The top left of the video is LEFT_EDGE,TOP_EDGE+CANVAS_HEIGHT
// and we test a pixel into the middle of each quadrant to avoid
// blending differences at the edges.
// If those values are ever changed, make sure to update
// WMFVideoMFTManager::CanUseDXVA accordingly.
//
// We allow massive amounts of fuzz for the colours since
// it can depend hugely on the yuv -> rgb conversion, and
// we don't want to fail unnecessarily.
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);
return testPixel(ctx, LEFT_EDGE + VIDEO_WIDTH / 4, TOP_EDGE + CANVAS_HEIGHT + VIDEO_HEIGHT / 4, 255, 255, 255, 255, 64) &&
testPixel(ctx, LEFT_EDGE + 3 * VIDEO_WIDTH / 4, TOP_EDGE + CANVAS_HEIGHT + VIDEO_HEIGHT / 4, 0, 255, 0, 255, 64) &&
testPixel(ctx, LEFT_EDGE + VIDEO_WIDTH / 4, TOP_EDGE + CANVAS_HEIGHT + 3 * VIDEO_HEIGHT / 4, 0, 0, 255, 255, 64) &&
testPixel(ctx, LEFT_EDGE+ 3 * VIDEO_WIDTH / 4, TOP_EDGE + CANVAS_HEIGHT + 3 * VIDEO_HEIGHT / 4, 255, 0, 0, 255, 64);
}
// Verify that the middle of the layers test is the color we expect.