should I iterate over all possible values other than sizeof(MONITORINFO) and sizeof(MONITORINFOEXA) ? Kind Regards, Patrick Rudolph
Originalnachricht Von: Alexandre Julliard Gesendet: Freitag, 18. April 2014 13:47 An: Patrick Rudolph Cc: wine-devel@winehq.org Betreff: Re: [PATCH 2/2] user32: add tests for valid cbSize in GetMonitorInfoA
Patrick Rudolph siro@das-labor.org writes:
@@ -362,6 +363,21 @@ static void test_monitors(void) monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONULL ); }
- /* sanity check */
- monitor = pMonitorFromRect( &rc, MONITOR_DEFAULTTONEAREST );
- mi.cbSize = sizeof(mi);
- ret = pGetMonitorInfoA( monitor, &mi );
- ok( ret, "GetMonitorInfo failed\n" );
- miex.cbSize = sizeof(miex);
- ret = pGetMonitorInfoA( monitor, (LPMONITORINFO)&miex );
- ok( ret, "GetMonitorInfo failed\n" );
- /* specify invalid cbSize */
- mi.cbSize = 0xdeadbeef;
- ret = pGetMonitorInfoA( monitor, &mi );
- ok( !ret, "GetMonitorInfo succeded\n" );
That's not a very convincing test.
On Fri, Apr 18, 2014 at 8:52 AM, siro@das-labor.org wrote:
should I iterate over all possible values other than sizeof(MONITORINFO) and sizeof(MONITORINFOEXA) ? Kind Regards, Patrick Rudolph
This is what I would do: Try to test sizeof(mi)+1, sizeof(mi)-1, -1, 0, 0xdeadbeef (and the same for miex). Memset(0) the structure before each test and choose a field that should never be zero to test if the struct was correctly filled aside from the success return value.
Best Regards, Bruno