From: Elizabeth Figura zfigura@codeweavers.com
--- configure | 1 + configure.ac | 1 + dlls/ir50_32/tests/Makefile.in | 5 ++ dlls/ir50_32/tests/ir50_32.c | 149 +++++++++++++++++++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 dlls/ir50_32/tests/Makefile.in create mode 100644 dlls/ir50_32/tests/ir50_32.c
diff --git a/configure b/configure index 681195a4c91..6346b6e96f2 100755 --- a/configure +++ b/configure @@ -22500,6 +22500,7 @@ wine_fn_config_makefile dlls/iphlpapi enable_iphlpapi wine_fn_config_makefile dlls/iphlpapi/tests enable_tests wine_fn_config_makefile dlls/iprop enable_iprop wine_fn_config_makefile dlls/ir50_32 enable_ir50_32 +wine_fn_config_makefile dlls/ir50_32/tests enable_tests wine_fn_config_makefile dlls/irprops.cpl enable_irprops_cpl wine_fn_config_makefile dlls/itircl enable_itircl wine_fn_config_makefile dlls/itss enable_itss diff --git a/configure.ac b/configure.ac index 848d8329554..1f64396a6e0 100644 --- a/configure.ac +++ b/configure.ac @@ -2790,6 +2790,7 @@ WINE_CONFIG_MAKEFILE(dlls/iphlpapi) WINE_CONFIG_MAKEFILE(dlls/iphlpapi/tests) WINE_CONFIG_MAKEFILE(dlls/iprop) WINE_CONFIG_MAKEFILE(dlls/ir50_32) +WINE_CONFIG_MAKEFILE(dlls/ir50_32/tests) WINE_CONFIG_MAKEFILE(dlls/irprops.cpl) WINE_CONFIG_MAKEFILE(dlls/itircl) WINE_CONFIG_MAKEFILE(dlls/itss) diff --git a/dlls/ir50_32/tests/Makefile.in b/dlls/ir50_32/tests/Makefile.in new file mode 100644 index 00000000000..6be99cf493e --- /dev/null +++ b/dlls/ir50_32/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = ir50_32.dll +IMPORTS = msvfw32 + +SOURCES = \ + ir50_32.c diff --git a/dlls/ir50_32/tests/ir50_32.c b/dlls/ir50_32/tests/ir50_32.c new file mode 100644 index 00000000000..c5820fb312f --- /dev/null +++ b/dlls/ir50_32/tests/ir50_32.c @@ -0,0 +1,149 @@ +/* + * Copyright 2025 Elizabeth Figura for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <windef.h> +#include <wingdi.h> +#include <vfw.h> +#include "wine/test.h" + +static void test_formats(void) +{ + char buffer[offsetof(BITMAPINFO, bmiColors[256])]; + BITMAPINFOHEADER in = {.biSize = sizeof(BITMAPINFOHEADER)}; + BITMAPINFO *out = (BITMAPINFO *)buffer; + LRESULT ret; + ICINFO info; + HIC hic; + + in.biCompression = mmioFOURCC('i','v','5','0'); + + hic = ICLocate(ICTYPE_VIDEO, mmioFOURCC('i','v','5','0'), &in, NULL, ICMODE_DECOMPRESS); + todo_wine ok(!!hic, "Failed to open codec.\n"); + if (!hic) + return; + + ret = ICGetInfo(hic, &info, sizeof(info)); + ok(ret == sizeof(info), "Got %Id.\n", ret); + ok(info.dwSize == sizeof(info), "Got size %lu.\n", info.dwSize); + ok(info.fccType == ICTYPE_VIDEO, "Got type %#lx.\n", info.fccType); + ok(info.fccHandler == mmioFOURCC('I','V','5','0'), "Got handler %#lx.\n", info.fccHandler); + todo_wine ok(info.dwFlags == (VIDCF_QUALITY | VIDCF_CRUNCH | VIDCF_TEMPORAL | VIDCF_COMPRESSFRAMES | VIDCF_FASTTEMPORALC), + "Got flags %#lx.\n", info.dwFlags); + todo_wine ok(info.dwVersion == 0x32, "Got version %#lx.\n", info.dwVersion); + ok(info.dwVersionICM == ICVERSION, "Got ICM version %#lx.\n", info.dwVersionICM); + + ret = ICDecompressQuery(hic, &in, NULL); + ok(ret == ICERR_OK, "Got %Id.\n", ret); + + ret = ICDecompressGetFormat(hic, &in, NULL); + todo_wine ok(ret == offsetof(BITMAPINFO, bmiColors[256]), "Got %Id.\n", ret); + + in.biWidth = 320; + in.biHeight = 240; + in.biXPelsPerMeter = 12; + in.biYPelsPerMeter = 34; + in.biClrUsed = 111; + in.biClrImportant = 111; + + memset(buffer, 0xcc, sizeof(buffer)); + ret = ICDecompressGetFormat(hic, &in, out); + ok(ret == ICERR_OK, "Got %Id.\n", ret); + ok(out->bmiHeader.biSize == sizeof(BITMAPINFOHEADER), "Got size %lu.\n", out->bmiHeader.biSize); + ok(out->bmiHeader.biWidth == 320, "Got width %ld.\n", out->bmiHeader.biWidth); + ok(out->bmiHeader.biHeight == 240, "Got height %ld.\n", out->bmiHeader.biHeight); + todo_wine ok(out->bmiHeader.biPlanes == 1, "Got %u planes.\n", out->bmiHeader.biPlanes); + todo_wine ok(out->bmiHeader.biBitCount == 24, "Got depth %u.\n", out->bmiHeader.biBitCount); + ok(out->bmiHeader.biCompression == BI_RGB, "Got compression %#lx.\n", out->bmiHeader.biCompression); + todo_wine ok(out->bmiHeader.biSizeImage == 320 * 240 * 3, "Got image size %lu.\n", out->bmiHeader.biSizeImage); + todo_wine ok(!out->bmiHeader.biXPelsPerMeter, "Got horizontal resolution %ld.\n", out->bmiHeader.biXPelsPerMeter); + todo_wine ok(!out->bmiHeader.biYPelsPerMeter, "Got vertical resolution %ld.\n", out->bmiHeader.biYPelsPerMeter); + todo_wine ok(!out->bmiHeader.biClrUsed, "Got %lu used colours.\n", out->bmiHeader.biClrUsed); + todo_wine ok(!out->bmiHeader.biClrImportant, "Got %lu important colours.\n", out->bmiHeader.biClrImportant); + ok(out->bmiColors[0].rgbRed == 0xcc, "Expected colours to be unmodified.\n"); + + ret = ICDecompressQuery(hic, &in, out); + ok(ret == ICERR_OK, "Got %Id.\n", ret); + + out->bmiHeader.biHeight = -240; + out->bmiHeader.biSizeImage = 0; + out->bmiHeader.biPlanes = 0; + ret = ICDecompressQuery(hic, &in, out); + ok(ret == ICERR_OK, "Got %Id.\n", ret); + + out->bmiHeader.biHeight = -480; + ret = ICDecompressQuery(hic, &in, out); + todo_wine ok(ret == ICERR_BADPARAM, "Got %Id.\n", ret); + out->bmiHeader.biHeight = -240; + + out->bmiHeader.biWidth = 640; + ret = ICDecompressQuery(hic, &in, out); + todo_wine ok(ret == ICERR_BADPARAM, "Got %Id.\n", ret); + out->bmiHeader.biWidth = 320; + + out->bmiHeader.biBitCount = 8; + ret = ICDecompressQuery(hic, &in, out); + todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret); + out->bmiHeader.biBitCount = 16; + ret = ICDecompressQuery(hic, &in, out); + ok(ret == ICERR_OK, "Got %Id.\n", ret); + out->bmiHeader.biBitCount = 32; + ret = ICDecompressQuery(hic, &in, out); + ok(ret == ICERR_OK, "Got %Id.\n", ret); + + out->bmiHeader.biBitCount = 16; + out->bmiHeader.biCompression = BI_BITFIELDS; + ret = ICDecompressQuery(hic, &in, out); + ok(ret == ICERR_BADFORMAT, "Got %Id.\n", ret); + ((DWORD *)&out->bmiColors[0])[0] = 0xf800; + ((DWORD *)&out->bmiColors[0])[1] = 0x07e0; + ((DWORD *)&out->bmiColors[0])[2] = 0x001f; + ret = ICDecompressQuery(hic, &in, out); + todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret); + + out->bmiHeader.biCompression = mmioFOURCC('C','L','J','R'); + out->bmiHeader.biBitCount = 8; + ret = ICDecompressQuery(hic, &in, out); + ok(ret == ICERR_BADFORMAT, "Got %Id.\n", ret); + + out->bmiHeader.biBitCount = 16; + out->bmiHeader.biCompression = mmioFOURCC('U','Y','V','Y'); + ret = ICDecompressQuery(hic, &in, out); + todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret); + out->bmiHeader.biCompression = mmioFOURCC('Y','U','Y','2'); + ret = ICDecompressQuery(hic, &in, out); + todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret); + + ret = ICDecompressEnd(hic); + todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret); + + out->bmiHeader.biCompression = BI_RGB; + out->bmiHeader.biBitCount = 24; + ret = ICDecompressBegin(hic, &in, out); + ok(ret == ICERR_OK, "Got %Id.\n", ret); + + ret = ICDecompressEnd(hic); + todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret); + + ret = ICClose(hic); + ok(!ret, "Got %Id.\n", ret); +} + +START_TEST(ir50_32) +{ + test_formats(); +}
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ir50_32/ir50.c | 4 ++-- dlls/ir50_32/tests/ir50_32.c | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/ir50_32/ir50.c b/dlls/ir50_32/ir50.c index 69700359e99..ed57e135a2c 100644 --- a/dlls/ir50_32/ir50.c +++ b/dlls/ir50_32/ir50.c @@ -74,7 +74,7 @@ IV50_DecompressQuery( LPBITMAPINFO in, LPBITMAPINFO out ) TRACE("in->width = %ld\n", in->bmiHeader.biWidth); TRACE("in->compr = %#lx\n", in->bmiHeader.biCompression);
- if ( in->bmiHeader.biCompression != IV50_MAGIC ) + if (compare_fourcc(in->bmiHeader.biCompression, IV50_MAGIC)) { TRACE("can't do %#lx compression\n", in->bmiHeader.biCompression); return ICERR_BADFORMAT; @@ -123,7 +123,7 @@ IV50_DecompressGetFormat( LPBITMAPINFO in, LPBITMAPINFO out ) if ( !in ) return ICERR_BADPARAM;
- if ( in->bmiHeader.biCompression != IV50_MAGIC ) + if (compare_fourcc(in->bmiHeader.biCompression, IV50_MAGIC)) return ICERR_BADFORMAT;
size = in->bmiHeader.biSize; diff --git a/dlls/ir50_32/tests/ir50_32.c b/dlls/ir50_32/tests/ir50_32.c index c5820fb312f..064a80a0b82 100644 --- a/dlls/ir50_32/tests/ir50_32.c +++ b/dlls/ir50_32/tests/ir50_32.c @@ -33,9 +33,7 @@ static void test_formats(void) in.biCompression = mmioFOURCC('i','v','5','0');
hic = ICLocate(ICTYPE_VIDEO, mmioFOURCC('i','v','5','0'), &in, NULL, ICMODE_DECOMPRESS); - todo_wine ok(!!hic, "Failed to open codec.\n"); - if (!hic) - return; + ok(!!hic, "Failed to open codec.\n");
ret = ICGetInfo(hic, &info, sizeof(info)); ok(ret == sizeof(info), "Got %Id.\n", ret);
From: Elizabeth Figura zfigura@codeweavers.com
Native will crash here. Get rid of code we don't need. --- dlls/ir50_32/ir50.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/dlls/ir50_32/ir50.c b/dlls/ir50_32/ir50.c index ed57e135a2c..1fba354180d 100644 --- a/dlls/ir50_32/ir50.c +++ b/dlls/ir50_32/ir50.c @@ -120,9 +120,6 @@ IV50_DecompressGetFormat( LPBITMAPINFO in, LPBITMAPINFO out )
TRACE("ICM_DECOMPRESS_GETFORMAT %p %p\n", in, out);
- if ( !in ) - return ICERR_BADPARAM; - if (compare_fourcc(in->bmiHeader.biCompression, IV50_MAGIC)) return ICERR_BADFORMAT;
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ir50_32/ir50.c | 2 +- dlls/ir50_32/tests/ir50_32.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ir50_32/ir50.c b/dlls/ir50_32/ir50.c index 1fba354180d..437dafa50f4 100644 --- a/dlls/ir50_32/ir50.c +++ b/dlls/ir50_32/ir50.c @@ -366,7 +366,7 @@ LRESULT WINAPI IV50_DriverProc( DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg, break;
case ICM_DECOMPRESS_END: - r = ICERR_UNSUPPORTED; + r = ICERR_OK; break;
case ICM_DECOMPRESSEX_QUERY: diff --git a/dlls/ir50_32/tests/ir50_32.c b/dlls/ir50_32/tests/ir50_32.c index 064a80a0b82..7c569076601 100644 --- a/dlls/ir50_32/tests/ir50_32.c +++ b/dlls/ir50_32/tests/ir50_32.c @@ -127,7 +127,7 @@ static void test_formats(void) todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret);
ret = ICDecompressEnd(hic); - todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret); + ok(ret == ICERR_OK, "Got %Id.\n", ret);
out->bmiHeader.biCompression = BI_RGB; out->bmiHeader.biBitCount = 24; @@ -135,7 +135,7 @@ static void test_formats(void) ok(ret == ICERR_OK, "Got %Id.\n", ret);
ret = ICDecompressEnd(hic); - todo_wine ok(ret == ICERR_OK, "Got %Id.\n", ret); + ok(ret == ICERR_OK, "Got %Id.\n", ret);
ret = ICClose(hic); ok(!ret, "Got %Id.\n", ret);
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ir50_32/ir50.c | 4 ++-- dlls/ir50_32/tests/ir50_32.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/ir50_32/ir50.c b/dlls/ir50_32/ir50.c index 437dafa50f4..53f25c984ee 100644 --- a/dlls/ir50_32/ir50.c +++ b/dlls/ir50_32/ir50.c @@ -129,8 +129,8 @@ IV50_DecompressGetFormat( LPBITMAPINFO in, LPBITMAPINFO out ) memcpy( out, in, size ); out->bmiHeader.biHeight = abs(in->bmiHeader.biHeight); out->bmiHeader.biCompression = BI_RGB; - out->bmiHeader.biBitCount = 32; - out->bmiHeader.biSizeImage = out->bmiHeader.biWidth * out->bmiHeader.biHeight * 4; + out->bmiHeader.biBitCount = 24; + out->bmiHeader.biSizeImage = out->bmiHeader.biWidth * out->bmiHeader.biHeight * 3; return ICERR_OK; }
diff --git a/dlls/ir50_32/tests/ir50_32.c b/dlls/ir50_32/tests/ir50_32.c index 7c569076601..c902309c0c9 100644 --- a/dlls/ir50_32/tests/ir50_32.c +++ b/dlls/ir50_32/tests/ir50_32.c @@ -65,9 +65,9 @@ static void test_formats(void) ok(out->bmiHeader.biWidth == 320, "Got width %ld.\n", out->bmiHeader.biWidth); ok(out->bmiHeader.biHeight == 240, "Got height %ld.\n", out->bmiHeader.biHeight); todo_wine ok(out->bmiHeader.biPlanes == 1, "Got %u planes.\n", out->bmiHeader.biPlanes); - todo_wine ok(out->bmiHeader.biBitCount == 24, "Got depth %u.\n", out->bmiHeader.biBitCount); + ok(out->bmiHeader.biBitCount == 24, "Got depth %u.\n", out->bmiHeader.biBitCount); ok(out->bmiHeader.biCompression == BI_RGB, "Got compression %#lx.\n", out->bmiHeader.biCompression); - todo_wine ok(out->bmiHeader.biSizeImage == 320 * 240 * 3, "Got image size %lu.\n", out->bmiHeader.biSizeImage); + ok(out->bmiHeader.biSizeImage == 320 * 240 * 3, "Got image size %lu.\n", out->bmiHeader.biSizeImage); todo_wine ok(!out->bmiHeader.biXPelsPerMeter, "Got horizontal resolution %ld.\n", out->bmiHeader.biXPelsPerMeter); todo_wine ok(!out->bmiHeader.biYPelsPerMeter, "Got vertical resolution %ld.\n", out->bmiHeader.biYPelsPerMeter); todo_wine ok(!out->bmiHeader.biClrUsed, "Got %lu used colours.\n", out->bmiHeader.biClrUsed);
Fwiw there are tests already in mf:transform, and some todo_wine that would need to be removed.