winex11.drv: Fix ordering of synthesized text formats.

This commit is contained in:
Huw Davies 2009-04-17 14:46:06 +01:00 committed by Alexandre Julliard
parent ea0b3b42eb
commit 0d4451a85d
2 changed files with 72 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include "wine/test.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
static BOOL is_win9x = FALSE;
@ -190,6 +191,75 @@ todo_wine
test_last_error(ERROR_CLIPBOARD_NOT_OPEN);
}
static HGLOBAL create_text(void)
{
HGLOBAL h = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE, 5);
char *p = GlobalLock(h);
strcpy(p, "test");
GlobalUnlock(h);
return h;
}
static HENHMETAFILE create_emf(void)
{
const RECT rect = {0, 0, 100, 100};
HDC hdc = CreateEnhMetaFileA(NULL, NULL, &rect, "HENHMETAFILE Ole Clipboard Test\0Test\0\0");
ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rect, "Test String", strlen("Test String"), NULL);
return CloseEnhMetaFile(hdc);
}
static void test_synthesized(void)
{
HGLOBAL h, htext;
HENHMETAFILE emf;
BOOL r;
UINT cf;
htext = create_text();
emf = create_emf();
r = OpenClipboard(NULL);
ok(r, "gle %d\n", GetLastError());
r = EmptyClipboard();
ok(r, "gle %d\n", GetLastError());
h = SetClipboardData(CF_TEXT, htext);
ok(h == htext, "got %p\n", h);
h = SetClipboardData(CF_ENHMETAFILE, emf);
ok(h == emf, "got %p\n", h);
r = CloseClipboard();
ok(r, "gle %d\n", GetLastError());
r = OpenClipboard(NULL);
ok(r, "gle %d\n", GetLastError());
cf = EnumClipboardFormats(0);
ok(cf == CF_TEXT, "cf %08x\n", cf);
cf = EnumClipboardFormats(cf);
ok(cf == CF_ENHMETAFILE, "cf %08x\n", cf);
cf = EnumClipboardFormats(cf);
todo_wine ok(cf == CF_LOCALE, "cf %08x\n", cf);
if(cf == CF_LOCALE)
cf = EnumClipboardFormats(cf);
ok(cf == CF_OEMTEXT, "cf %08x\n", cf);
cf = EnumClipboardFormats(cf);
ok(cf == CF_UNICODETEXT, "cf %08x\n", cf);
cf = EnumClipboardFormats(cf);
todo_wine ok(cf == CF_METAFILEPICT, "cf %08x\n", cf);
if(cf == CF_METAFILEPICT)
cf = EnumClipboardFormats(cf);
ok(cf == 0, "cf %08x\n", cf);
r = EmptyClipboard();
ok(r, "gle %d\n", GetLastError());
r = CloseClipboard();
ok(r, "gle %d\n", GetLastError());
}
START_TEST(clipboard)
{
SetLastError(0xdeadbeef);
@ -198,4 +268,5 @@ START_TEST(clipboard)
test_RegisterClipboardFormatA();
test_ClipboardOwner();
test_synthesized();
}

View File

@ -2778,9 +2778,9 @@ void CDECL X11DRV_EndClipboardUpdate(void)
INT count = ClipDataCount;
/* Do Unicode <-> Text <-> OEM mapping */
X11DRV_CLIPBOARD_SynthesizeData(CF_UNICODETEXT);
X11DRV_CLIPBOARD_SynthesizeData(CF_TEXT);
X11DRV_CLIPBOARD_SynthesizeData(CF_OEMTEXT);
X11DRV_CLIPBOARD_SynthesizeData(CF_UNICODETEXT);
/* Enhmetafile <-> MetafilePict mapping */
X11DRV_CLIPBOARD_SynthesizeData(CF_ENHMETAFILE);