mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 03:08:19 +00:00
mfplat/tests: Use a more unique pattern when testing image formats.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fcabfeea8f
commit
496073d506
|
@ -5994,7 +5994,48 @@ static void test_MFCreate2DMediaBuffer(void)
|
||||||
ok(length2 == ptr->contiguous_length, "%d: unexpected linear buffer length %lu for %u x %u, format %s.\n",
|
ok(length2 == ptr->contiguous_length, "%d: unexpected linear buffer length %lu for %u x %u, format %s.\n",
|
||||||
i, length2, ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->fourcc, 4));
|
i, length2, ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->fourcc, 4));
|
||||||
|
|
||||||
memset(data, 0xff, length2);
|
hr = pMFGetStrideForBitmapInfoHeader(ptr->fourcc, ptr->width, &stride);
|
||||||
|
ok(hr == S_OK, "Failed to get stride, hr %#lx.\n", hr);
|
||||||
|
stride = abs(stride);
|
||||||
|
|
||||||
|
/* primary plane */
|
||||||
|
ok(ptr->height * stride <= length2, "Insufficient buffer space: expected at least %lu bytes, got only %lu\n",
|
||||||
|
ptr->height * stride, length2);
|
||||||
|
for (j = 0; j < ptr->height; j++)
|
||||||
|
for (k = 0; k < stride; k++)
|
||||||
|
data[j * stride + k] = ((j % 16) << 4) + (k % 16);
|
||||||
|
|
||||||
|
data += ptr->height * stride;
|
||||||
|
|
||||||
|
/* secondary planes */
|
||||||
|
switch (ptr->fourcc)
|
||||||
|
{
|
||||||
|
case MAKEFOURCC('I','M','C','1'):
|
||||||
|
case MAKEFOURCC('I','M','C','3'):
|
||||||
|
ok(2 * ptr->height * stride <= length2, "Insufficient buffer space: expected at least %lu bytes, got only %lu\n",
|
||||||
|
2 * ptr->height * stride, length2);
|
||||||
|
for (j = 0; j < ptr->height; j++)
|
||||||
|
for (k = 0; k < stride / 2; k++)
|
||||||
|
data[j * stride + k] = (((j + ptr->height) % 16) << 4) + (k % 16);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MAKEFOURCC('I','M','C','2'):
|
||||||
|
case MAKEFOURCC('I','M','C','4'):
|
||||||
|
ok(stride * 3 / 2 * ptr->height <= length2, "Insufficient buffer space: expected at least %lu bytes, got only %lu\n",
|
||||||
|
stride * 3 / 2 * ptr->height, length2);
|
||||||
|
for (j = 0; j < ptr->height; j++)
|
||||||
|
for (k = 0; k < stride / 2; k++)
|
||||||
|
data[j * (stride / 2) + k] = (((j + ptr->height) % 16) << 4) + (k % 16);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MAKEFOURCC('N','V','1','2'):
|
||||||
|
ok(stride * ptr->height * 3 / 2 <= length2, "Insufficient buffer space: expected at least %lu bytes, got only %lu\n",
|
||||||
|
stride * ptr->height * 3 / 2, length2);
|
||||||
|
for (j = 0; j < ptr->height / 2; j++)
|
||||||
|
for (k = 0; k < stride; k++)
|
||||||
|
data[j * stride + k] = (((j + ptr->height) % 16) << 4) + (k % 16);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
hr = IMFMediaBuffer_Unlock(buffer);
|
hr = IMFMediaBuffer_Unlock(buffer);
|
||||||
ok(hr == S_OK, "Failed to unlock buffer, hr %#lx.\n", hr);
|
ok(hr == S_OK, "Failed to unlock buffer, hr %#lx.\n", hr);
|
||||||
|
@ -6008,37 +6049,42 @@ static void test_MFCreate2DMediaBuffer(void)
|
||||||
ok(pitch == pitch2, "Unexpected pitch.\n");
|
ok(pitch == pitch2, "Unexpected pitch.\n");
|
||||||
|
|
||||||
/* primary plane */
|
/* primary plane */
|
||||||
for(j = 0; j < ptr->height; j++)
|
for (j = 0; j < ptr->height; j++)
|
||||||
for (k = 0; k < ptr->width; k++)
|
for (k = 0; k < stride; k++)
|
||||||
ok(data[j * pitch + k] == 0xff, "Unexpected byte %02x at test %d row %d column %d.\n", data[j * pitch + k], i, j, k);
|
ok(data[j * pitch + k] == ((j % 16) << 4) + (k % 16),
|
||||||
|
"Unexpected byte %02x instead of %02x at test %d row %d column %d.\n",
|
||||||
|
data[j * pitch + k], ((j % 16) << 4) + (k % 16), i, j, k);
|
||||||
|
|
||||||
hr = pMFGetStrideForBitmapInfoHeader(ptr->fourcc, ptr->width, &stride);
|
data += ptr->height * pitch;
|
||||||
ok(hr == S_OK, "Failed to get stride, hr %#lx.\n", hr);
|
|
||||||
|
|
||||||
/* secondary planes */
|
/* secondary planes */
|
||||||
switch (ptr->fourcc)
|
switch (ptr->fourcc)
|
||||||
{
|
{
|
||||||
case MAKEFOURCC('I','M','C','1'):
|
case MAKEFOURCC('I','M','C','1'):
|
||||||
case MAKEFOURCC('I','M','C','3'):
|
case MAKEFOURCC('I','M','C','3'):
|
||||||
for (j = ptr->height; j < length2 / stride; j++)
|
for (j = 0; j < ptr->height; j++)
|
||||||
for (k = 0; k < ptr->width / 2; k++)
|
for (k = 0; k < stride / 2; k++)
|
||||||
ok(data[j * pitch + k] == 0xff, "Unexpected byte %02x at test %d row %d column %d.\n", data[j * pitch + k], i, j, k);
|
ok(data[j * pitch + k] == (((j + ptr->height) % 16) << 4) + (k % 16),
|
||||||
|
"Unexpected byte %02x instead of %02x at test %d row %d column %d.\n",
|
||||||
|
data[j * pitch + k], (((j + ptr->height) % 16) << 4) + (k % 16), i, j + ptr->height, k);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAKEFOURCC('I','M','C','2'):
|
case MAKEFOURCC('I','M','C','2'):
|
||||||
case MAKEFOURCC('I','M','C','4'):
|
case MAKEFOURCC('I','M','C','4'):
|
||||||
for (j = ptr->height; j < length2 / stride; j++)
|
for (j = 0; j < ptr->height; j++)
|
||||||
for (k = 0; k < ptr->width / 2; k++)
|
for (k = 0; k < stride / 2; k++)
|
||||||
ok(data[j * pitch + k] == 0xff, "Unexpected byte %02x at test %d row %d column %d.\n", data[j * pitch + k], i, j, k);
|
todo_wine_if(ptr->height % 2 == 1 && j >= 2)
|
||||||
for (j = ptr->height; j < length2 / stride; j++)
|
ok(data[j * (pitch / 2) + k] == (((j + ptr->height) % 16) << 4) + (k % 16),
|
||||||
for (k = pitch / 2; k < pitch / 2 + ptr->width / 2; k++)
|
"Unexpected byte %02x instead of %02x at test %d row %d column %d.\n",
|
||||||
ok(data[j * pitch + k] == 0xff, "Unexpected byte %02x at test %d row %d column %d.\n", data[j * pitch + k], i, j, k);
|
data[j * (pitch / 2) + k], (((j + ptr->height) % 16) << 4) + (k % 16), i, j + ptr->height, k);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAKEFOURCC('N','V','1','2'):
|
case MAKEFOURCC('N','V','1','2'):
|
||||||
for (j = ptr->height; j < length2 / stride; j++)
|
for (j = 0; j < ptr->height / 2; j++)
|
||||||
for (k = 0; k < ptr->width; k++)
|
for (k = 0; k < stride; k++)
|
||||||
ok(data[j * pitch + k] == 0xff, "Unexpected byte %02x at test %d row %d column %d.\n", data[j * pitch + k], i, j, k);
|
ok(data[j * pitch + k] == (((j + ptr->height) % 16) << 4) + (k % 16),
|
||||||
|
"Unexpected byte %02x instead of %02x at test %d row %d column %d.\n",
|
||||||
|
data[j * pitch + k], (((j + ptr->height) % 16) << 4) + (k % 16), i, j + ptr->height, k);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue