On Thu, Jul 20, 2017 at 10:56:40PM +0900, Akihiro Sagawa wrote:
To avoid division by zero (Bug 43369).
In version 3, refine a testcase. The refresh rate value is neither zero nor negative, thus we should test both. Thanks for reviewing.
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com
dlls/gdi32/driver.c | 2 +- dlls/gdi32/tests/dc.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index fe7812c..6a3975a 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -344,7 +344,7 @@ static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap ) case PHYSICALOFFSETY: return 0; case SCALINGFACTORX: return 0; case SCALINGFACTORY: return 0;
- case VREFRESH: return 0;
- case VREFRESH: return GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY ? 1 : 0; case DESKTOPVERTRES: return GetDeviceCaps( dev->hdc, VERTRES ); case DESKTOPHORZRES: return GetDeviceCaps( dev->hdc, HORZRES ); case BLTALIGNMENT: return 0;
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index add2c04..d316f3f 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -388,6 +388,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale { INT precision = 0; INT hdc_caps = GetDeviceCaps( hdc, caps[i] );
INT ref_caps; switch (caps[i]) {
@@ -400,6 +401,13 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale case LOGPIXELSY: hdc_caps *= scale; break;
case VREFRESH:
ref_caps = GetDeviceCaps( ref_dc, caps[i] );
if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY)
ok( ref_caps > 0, "expected a positive value on %s, got %d\n", descr, ref_caps );
else
ok( ref_caps == 0, "expected 0 on %s, got %d\n", descr, ref_caps );
break; }
You don't want to use 'ref_dc' here, use 'hdc' instead. Also, note that 'hdc_caps' already contains the thing you want to test, so you don't need the first call to GetDeviceCaps().
Huw.