msvfw32-ICGetDisplayFormat: Update patchset and add some more tests.

This commit is contained in:
Sebastian Lackner 2016-03-31 17:20:11 +02:00
parent 962403c7ca
commit 9d68d56c29
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,64 @@
From 37a47ad2b8a776a15d1e0431c0e1c1924884fbe1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 31 Mar 2016 17:17:20 +0200
Subject: msvfw32: Add test for negative width/height values passed to
ICGetDisplayFormat.
---
dlls/msvfw32/msvideo_main.c | 4 ++--
dlls/msvfw32/tests/msvfw.c | 16 ++++++++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index 28f405e..41bd234 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -747,8 +747,8 @@ HIC VFWAPI ICGetDisplayFormat(
screen_depth = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);
ReleaseDC(0, hdc);
- if (!dx) dx = lpbiIn->biWidth;
- if (!dy) dy = lpbiIn->biHeight;
+ if (dx <= 0) dx = lpbiIn->biWidth;
+ if (dy <= 0) dy = lpbiIn->biHeight;
if (!depth) depth = screen_depth;
/* Can we decompress it ? */
diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c
index 7fd4c43..36dec1d 100644
--- a/dlls/msvfw32/tests/msvfw.c
+++ b/dlls/msvfw32/tests/msvfw.c
@@ -357,9 +357,19 @@ static struct msg_result expected_msgs[] =
{34, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
{35, ICM_DECOMPRESS_QUERY, TRUE, 800, 600, 32, BI_RGB, ICERR_OK, FALSE},
+ /* test 9 */
+ {36, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {37, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {38, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
+ /* test 10 */
+ {39, ICM_DECOMPRESS_QUERY, FALSE, 0, 0, 0, 0, ICERR_OK, FALSE},
+ {40, ICM_DECOMPRESS_GET_FORMAT, TRUE, 320, 240, 16, BI_RGB, ICERR_OK, FALSE},
+ {41, ICM_DECOMPRESS_QUERY, TRUE, 640, 480, 32, BI_RGB, ICERR_OK, FALSE},
+
/* Wine bug - shouldn't be called */
- {36, DRV_DISABLE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
- {36, DRV_FREE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
+ {42, DRV_DISABLE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
+ {42, DRV_FREE, FALSE, 0, 0, 0, 0, ICERR_OK, TRUE},
};
static int msg_index = 0;
@@ -481,6 +491,8 @@ void test_ICGetDisplayFormat(void)
{ 0, 32, 0, 640, 0, 480, 28},
{ 9, 64, 0, 640, 0, 480, 33},
{32, 32, 800, 800, 600, 600, 36},
+ {32, 32, -1, 640, -1, 480, 39},
+ {32, 32, -90, 640, -60, 480, 42},
};
HIC ic, ic2;
--
2.7.1

View File

@ -4631,8 +4631,10 @@ fi
# |
if test "$enable_msvfw32_ICGetDisplayFormat" -eq 1; then
patch_apply msvfw32-ICGetDisplayFormat/0001-msvfw32-Try-different-formarts-in-ICGetDisplayFormat.patch
patch_apply msvfw32-ICGetDisplayFormat/0002-msvfw32-Add-test-for-negative-width-height-values-pa.patch
(
echo '+ { "Michael Müller", "msvfw32: Try different formarts in ICGetDisplayFormat.", 1 },';
echo '+ { "Michael Müller", "msvfw32: Add test for negative width/height values passed to ICGetDisplayFormat.", 1 },';
) >> "$patchlist"
fi