user32/tests: Use wine_{push,pop}_context() to simplify test_synthesized().
Signed-off-by: Francois Gouget <fgouget@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d86207c1d7
commit
c59cd90633
|
@ -714,10 +714,11 @@ static void test_synthesized(void)
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||||
{
|
{
|
||||||
|
winetest_push_context("%d", i);
|
||||||
r = OpenClipboard(NULL);
|
r = OpenClipboard(NULL);
|
||||||
ok(r, "%u: gle %d\n", i, GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
r = EmptyClipboard();
|
r = EmptyClipboard();
|
||||||
ok(r, "%u: gle %d\n", i, GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
|
|
||||||
switch (tests[i].format)
|
switch (tests[i].format)
|
||||||
{
|
{
|
||||||
|
@ -744,45 +745,50 @@ static void test_synthesized(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
count = CountClipboardFormats();
|
count = CountClipboardFormats();
|
||||||
ok( count == 1, "%u: count %u\n", i, count );
|
ok( count == 1, "count %u\n", count );
|
||||||
|
|
||||||
r = CloseClipboard();
|
r = CloseClipboard();
|
||||||
ok(r, "%u: gle %d\n", i, GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
|
|
||||||
count = CountClipboardFormats();
|
count = CountClipboardFormats();
|
||||||
for (j = 0; tests[i].expected[j]; j++)
|
for (j = 0; tests[i].expected[j]; j++)
|
||||||
{
|
{
|
||||||
r = IsClipboardFormatAvailable( tests[i].expected[j] );
|
r = IsClipboardFormatAvailable( tests[i].expected[j] );
|
||||||
ok( r, "%u: %04x not available\n", i, tests[i].expected[j] );
|
ok( r, "%04x not available\n", tests[i].expected[j] );
|
||||||
}
|
}
|
||||||
ok( count == j, "%u: count %u instead of %u\n", i, count, j );
|
ok( count == j, "count %u instead of %u\n", count, j );
|
||||||
|
|
||||||
r = OpenClipboard( hwnd );
|
r = OpenClipboard( hwnd );
|
||||||
ok(r, "%u: gle %d\n", i, GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
cf = 0;
|
cf = 0;
|
||||||
for (j = 0; tests[i].expected[j]; j++)
|
for (j = 0; tests[i].expected[j]; j++)
|
||||||
{
|
{
|
||||||
|
winetest_push_context("%d", j);
|
||||||
cf = EnumClipboardFormats( cf );
|
cf = EnumClipboardFormats( cf );
|
||||||
ok(cf == tests[i].expected[j], "%u.%u: got %04x instead of %04x\n",
|
ok(cf == tests[i].expected[j], "got %04x instead of %04x\n",
|
||||||
i, j, cf, tests[i].expected[j] );
|
cf, tests[i].expected[j] );
|
||||||
if (cf != tests[i].expected[j]) break;
|
if (cf != tests[i].expected[j])
|
||||||
|
{
|
||||||
|
winetest_pop_context();
|
||||||
|
break;
|
||||||
|
}
|
||||||
old_seq = GetClipboardSequenceNumber();
|
old_seq = GetClipboardSequenceNumber();
|
||||||
data = GetClipboardData( cf );
|
data = GetClipboardData( cf );
|
||||||
ok(data != NULL ||
|
ok(data != NULL ||
|
||||||
broken( tests[i].format == CF_DIBV5 && cf == CF_DIB ), /* >= Vista */
|
broken( tests[i].format == CF_DIBV5 && cf == CF_DIB ), /* >= Vista */
|
||||||
"%u: couldn't get data, cf %04x err %d\n", i, cf, GetLastError());
|
"couldn't get data, cf %04x err %d\n", cf, GetLastError());
|
||||||
seq = GetClipboardSequenceNumber();
|
seq = GetClipboardSequenceNumber();
|
||||||
ok(seq == old_seq, "sequence changed (test %d %d)\n", i, cf);
|
ok(seq == old_seq, "sequence changed (test %d)\n", cf);
|
||||||
switch (cf)
|
switch (cf)
|
||||||
{
|
{
|
||||||
case CF_LOCALE:
|
case CF_LOCALE:
|
||||||
{
|
{
|
||||||
UINT *ptr = GlobalLock( data );
|
UINT *ptr = GlobalLock( data );
|
||||||
DWORD layout = LOWORD( GetKeyboardLayout(0) );
|
DWORD layout = LOWORD( GetKeyboardLayout(0) );
|
||||||
ok( GlobalSize( data ) == sizeof(*ptr), "%u: size %lu\n", i, GlobalSize( data ));
|
ok( GlobalSize( data ) == sizeof(*ptr), "size %lu\n", GlobalSize( data ));
|
||||||
ok( *ptr == layout ||
|
ok( *ptr == layout ||
|
||||||
broken( *ptr == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT )),
|
broken( *ptr == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT )),
|
||||||
"%u: CF_LOCALE %04x/%04x\n", i, *ptr, layout );
|
"CF_LOCALE %04x/%04x\n", *ptr, layout );
|
||||||
GlobalUnlock( data );
|
GlobalUnlock( data );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -794,82 +800,90 @@ static void test_synthesized(void)
|
||||||
ok( GlobalSize( data ) == 10 * sizeof(WCHAR), "wrong len %ld\n", GlobalSize( data ));
|
ok( GlobalSize( data ) == 10 * sizeof(WCHAR), "wrong len %ld\n", GlobalSize( data ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
winetest_pop_context();
|
||||||
}
|
}
|
||||||
if (!tests[i].expected[j])
|
if (!tests[i].expected[j])
|
||||||
{
|
{
|
||||||
cf = EnumClipboardFormats( cf );
|
cf = EnumClipboardFormats( cf );
|
||||||
ok(cf == 0, "%u: cf %04x\n", i, cf);
|
ok(cf == 0, "cf %04x\n", cf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now with delayed rendering */
|
/* now with delayed rendering */
|
||||||
|
|
||||||
r = EmptyClipboard();
|
r = EmptyClipboard();
|
||||||
ok(r, "%u: gle %d\n", i, GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
|
|
||||||
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
||||||
ok( !rendered, "%u: formats %08x have been rendered\n", i, rendered );
|
ok( !rendered, "formats %08x have been rendered\n", rendered );
|
||||||
|
|
||||||
SetClipboardData( tests[i].format, 0 );
|
SetClipboardData( tests[i].format, 0 );
|
||||||
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
||||||
ok( !rendered, "%u: formats %08x have been rendered\n", i, rendered );
|
ok( !rendered, "formats %08x have been rendered\n", rendered );
|
||||||
|
|
||||||
count = CountClipboardFormats();
|
count = CountClipboardFormats();
|
||||||
ok( count == 1, "%u: count %u\n", i, count );
|
ok( count == 1, "count %u\n", count );
|
||||||
|
|
||||||
r = CloseClipboard();
|
r = CloseClipboard();
|
||||||
ok(r, "%u: gle %d\n", i, GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
||||||
ok( !rendered, "%u: formats %08x have been rendered\n", i, rendered );
|
ok( !rendered, "formats %08x have been rendered\n", rendered );
|
||||||
|
|
||||||
count = CountClipboardFormats();
|
count = CountClipboardFormats();
|
||||||
for (j = 0; tests[i].expected[j]; j++)
|
for (j = 0; tests[i].expected[j]; j++)
|
||||||
{
|
{
|
||||||
r = IsClipboardFormatAvailable( tests[i].expected[j] );
|
r = IsClipboardFormatAvailable( tests[i].expected[j] );
|
||||||
ok( r, "%u: %04x not available\n", i, tests[i].expected[j] );
|
ok( r, "%04x not available\n", tests[i].expected[j] );
|
||||||
}
|
}
|
||||||
ok( count == j, "%u: count %u instead of %u\n", i, count, j );
|
ok( count == j, "count %u instead of %u\n", count, j );
|
||||||
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
||||||
ok( !rendered, "%u: formats %08x have been rendered\n", i, rendered );
|
ok( !rendered, "formats %08x have been rendered\n", rendered );
|
||||||
|
|
||||||
r = OpenClipboard(NULL);
|
r = OpenClipboard(NULL);
|
||||||
ok(r, "%u: gle %d\n", i, GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
cf = 0;
|
cf = 0;
|
||||||
for (j = 0; tests[i].expected[j]; j++)
|
for (j = 0; tests[i].expected[j]; j++)
|
||||||
{
|
{
|
||||||
|
winetest_push_context("%d", j);
|
||||||
cf = EnumClipboardFormats( cf );
|
cf = EnumClipboardFormats( cf );
|
||||||
ok(cf == tests[i].expected[j], "%u.%u: got %04x instead of %04x\n",
|
ok(cf == tests[i].expected[j], "got %04x instead of %04x\n",
|
||||||
i, j, cf, tests[i].expected[j] );
|
cf, tests[i].expected[j] );
|
||||||
if (cf != tests[i].expected[j]) break;
|
if (cf != tests[i].expected[j])
|
||||||
|
{
|
||||||
|
winetest_pop_context();
|
||||||
|
break;
|
||||||
|
}
|
||||||
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
||||||
ok( !rendered, "%u.%u: formats %08x have been rendered\n", i, j, rendered );
|
ok( !rendered, "formats %08x have been rendered\n", rendered );
|
||||||
data = GetClipboardData( cf );
|
data = GetClipboardData( cf );
|
||||||
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
||||||
if (cf == CF_LOCALE)
|
if (cf == CF_LOCALE)
|
||||||
{
|
{
|
||||||
ok(data != NULL, "%u: CF_LOCALE no data\n", i);
|
ok(data != NULL, "CF_LOCALE no data\n");
|
||||||
ok( !rendered, "%u.%u: formats %08x have been rendered\n", i, j, rendered );
|
ok( !rendered, "formats %08x have been rendered\n", rendered );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ok(!data, "%u: format %04x got data %p\n", i, cf, data);
|
ok(!data, "format %04x got data %p\n", cf, data);
|
||||||
ok( rendered == (1 << tests[i].format),
|
ok( rendered == (1 << tests[i].format),
|
||||||
"%u.%u: formats %08x have been rendered\n", i, j, rendered );
|
"formats %08x have been rendered\n", rendered );
|
||||||
/* try to render a second time */
|
/* try to render a second time */
|
||||||
data = GetClipboardData( cf );
|
data = GetClipboardData( cf );
|
||||||
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
||||||
ok( rendered == (1 << tests[i].format),
|
ok( rendered == (1 << tests[i].format),
|
||||||
"%u.%u: formats %08x have been rendered\n", i, j, rendered );
|
"formats %08x have been rendered\n", rendered );
|
||||||
}
|
}
|
||||||
|
winetest_pop_context();
|
||||||
}
|
}
|
||||||
if (!tests[i].expected[j])
|
if (!tests[i].expected[j])
|
||||||
{
|
{
|
||||||
cf = EnumClipboardFormats( cf );
|
cf = EnumClipboardFormats( cf );
|
||||||
ok(cf == 0, "%u: cf %04x\n", i, cf);
|
ok(cf == 0, "cf %04x\n", cf);
|
||||||
}
|
}
|
||||||
r = CloseClipboard();
|
r = CloseClipboard();
|
||||||
ok(r, "%u: gle %d\n", i, GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
|
||||||
ok( !rendered, "%u: formats %08x have been rendered\n", i, rendered );
|
ok( !rendered, "formats %08x have been rendered\n", rendered );
|
||||||
|
winetest_pop_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
r = OpenClipboard(NULL);
|
r = OpenClipboard(NULL);
|
||||||
|
|
Loading…
Reference in New Issue