Qian Hong : atl100/tests: Added more tests for class AtlAxWin100 and AtlAxWinLic100.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jan 14 14:35:43 CST 2015
Module: wine
Branch: master
Commit: 0486b4368d63aa6cb97727c4d97e6030dfab431f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0486b4368d63aa6cb97727c4d97e6030dfab431f
Author: Qian Hong <qhong at codeweavers.com>
Date: Tue Jan 13 17:01:42 2015 +0800
atl100/tests: Added more tests for class AtlAxWin100 and AtlAxWinLic100.
---
dlls/atl100/tests/atl.c | 170 ++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 156 insertions(+), 14 deletions(-)
diff --git a/dlls/atl100/tests/atl.c b/dlls/atl100/tests/atl.c
index 96abf57..dcc199f 100644
--- a/dlls/atl100/tests/atl.c
+++ b/dlls/atl100/tests/atl.c
@@ -591,28 +591,170 @@ static void test_source_iface(void)
static void test_ax_win(void)
{
- BOOL ret;
+ DWORD ret, ret_size, i;
+ HRESULT res;
+ HWND hwnd;
+ HANDLE hfile;
+ IUnknown *control;
+ WNDPROC wndproc[2] = {NULL, NULL};
+ WCHAR file_uri1W[MAX_PATH], pathW[MAX_PATH];
WNDCLASSEXW wcex;
- static const WCHAR AtlAxWin100[] = {'A','t','l','A','x','W','i','n','1','0','0',0};
- static const WCHAR AtlAxWinLic100[] = {'A','t','l','A','x','W','i','n','L','i','c','1','0','0',0};
static HMODULE hinstance = 0;
+ static const WCHAR emptyW[] = {'\0'};
+ static const WCHAR randomW[] = {'r','a','n','d','o','m','\0'};
+ static const WCHAR progid1W[] = {'S','h','e','l','l','.','E','x','p','l','o','r','e','r','.','2','\0'};
+ static const WCHAR clsid1W[] = {'{','8','8','5','6','f','9','6','1','-','3','4','0','a','-',
+ '1','1','d','0','-','a','9','6','b','-',
+ '0','0','c','0','4','f','d','7','0','5','a','2','}','\0'};
+ static const WCHAR url1W[] = {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q',
+ '.','o','r','g','/','t','e','s','t','s','/','w','i','n','e','h','q','_',
+ 's','n','a','p','s','h','o','t','/','\0'};
+ static const WCHAR mshtml1W[] = {'m','s','h','t','m','l',':','<','h','t','m','l','>','<','b','o','d','y','>',
+ 't','e','s','t','<','/','b','o','d','y','>','<','/','h','t','m','l','>','\0'};
+ static const WCHAR mshtml2W[] = {'M','S','H','T','M','L',':','<','h','t','m','l','>','<','b','o','d','y','>',
+ 't','e','s','t','<','/','b','o','d','y','>','<','/','h','t','m','l','>','\0'};
+ static const WCHAR mshtml3W[] = {'<','h','t','m','l','>','<','b','o','d','y','>', 't','e','s','t',
+ '<','/','b','o','d','y','>','<','/','h','t','m','l','>','\0'};
+ static const WCHAR fileW[] = {'f','i','l','e',':','/','/','/','\0'};
+ static const WCHAR html_fileW[] = {'t','e','s','t','.','h','t','m','l','\0'};
+ static const char html_str[] = "<html><body>test</body><html>";
+ static const WCHAR cls_names[][16] =
+ {
+ {'A','t','l','A','x','W','i','n','1','0','0',0},
+ {'A','t','l','A','x','W','i','n','L','i','c','1','0','0',0}
+ };
ret = AtlAxWinInit();
ok(ret, "AtlAxWinInit failed\n");
hinstance = GetModuleHandleA(NULL);
- memset(&wcex, 0, sizeof(wcex));
- wcex.cbSize = sizeof(wcex);
- ret = GetClassInfoExW(hinstance, AtlAxWin100, &wcex);
- ok(ret, "AtlAxWin100 has not registered\n");
- ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);
-
- memset(&wcex, 0, sizeof(wcex));
- wcex.cbSize = sizeof(wcex);
- ret = GetClassInfoExW(hinstance, AtlAxWinLic100, &wcex);
- ok(ret, "AtlAxWinLic100 has not registered\n");
- ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);
+ for (i = 0; i < 2; i++)
+ {
+ memset(&wcex, 0, sizeof(wcex));
+ wcex.cbSize = sizeof(wcex);
+ ret = GetClassInfoExW(hinstance, cls_names[i], &wcex);
+ ok(ret, "%s has not registered\n", wine_dbgstr_w(cls_names[i]));
+ ok(wcex.style == (CS_GLOBALCLASS | CS_DBLCLKS), "wcex.style %08x\n", wcex.style);
+ wndproc[i] = wcex.lpfnWndProc;
+
+ hwnd = CreateWindowW(cls_names[i], NULL, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = (IUnknown *)0xdeadbeef;
+ res = AtlAxGetControl(hwnd, &control);
+ todo_wine ok(res == E_FAIL, "Expected E_FAIL, returned %08x\n", res);
+ todo_wine ok(!control, "returned %p\n", control);
+ if (control) IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowW(cls_names[i], emptyW, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = (IUnknown *)0xdeadbeef;
+ res = AtlAxGetControl(hwnd, &control);
+ todo_wine ok(res == E_FAIL, "Expected E_FAIL, returned %08x\n", res);
+ todo_wine ok(!control, "returned %p\n", control);
+ if (control) IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowW(cls_names[i], randomW, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ todo_wine ok(!hwnd, "returned %p\n", hwnd);
+ if(hwnd) DestroyWindow(hwnd);
+
+ hwnd = CreateWindowW(cls_names[i], progid1W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = NULL;
+ res = AtlAxGetControl(hwnd, &control);
+ ok(res == S_OK, "AtlAxGetControl failed with res %08x\n", res);
+ ok(control != NULL, "AtlAxGetControl failed!\n");
+ IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowW(cls_names[i], clsid1W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = NULL;
+ res = AtlAxGetControl(hwnd, &control);
+ ok(res == S_OK, "AtlAxGetControl failed with res %08x\n", res);
+ ok(control != NULL, "AtlAxGetControl failed!\n");
+ IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowW(cls_names[i], url1W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = NULL;
+ res = AtlAxGetControl(hwnd, &control);
+ ok(res == S_OK, "AtlAxGetControl failed with res %08x\n", res);
+ ok(control != NULL, "AtlAxGetControl failed!\n");
+ IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ /* test html stream with "MSHTML:" prefix */
+ hwnd = CreateWindowW(cls_names[i], mshtml1W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = NULL;
+ res = AtlAxGetControl(hwnd, &control);
+ ok(res == S_OK, "AtlAxGetControl failed with res %08x\n", res);
+ ok(control != NULL, "AtlAxGetControl failed!\n");
+ IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ hwnd = CreateWindowW(cls_names[i], mshtml2W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = NULL;
+ res = AtlAxGetControl(hwnd, &control);
+ ok(res == S_OK, "AtlAxGetControl failed with res %08x\n", res);
+ ok(control != NULL, "AtlAxGetControl failed!\n");
+ IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ /* test html stream without "MSHTML:" prefix */
+ hwnd = CreateWindowW(cls_names[i], mshtml3W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ todo_wine ok(!hwnd, "returned %p\n", hwnd);
+ if(hwnd) DestroyWindow(hwnd);
+
+ ret = GetTempPathW(MAX_PATH, pathW);
+ ok(ret, "GetTempPath failed!\n");
+ lstrcatW(pathW, html_fileW);
+ hfile = CreateFileW(pathW, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0);
+ ok(hfile != INVALID_HANDLE_VALUE, "failed to create file\n");
+ ret = WriteFile(hfile, html_str, sizeof(html_str), &ret_size, NULL);
+ ok(ret, "WriteFile failed\n");
+ CloseHandle(hfile);
+
+ /* test C:// scheme */
+ hwnd = CreateWindowW(cls_names[i], pathW, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = NULL;
+ res = AtlAxGetControl(hwnd, &control);
+ ok(res == S_OK, "AtlAxGetControl failed with res %08x\n", res);
+ ok(control != NULL, "AtlAxGetControl failed!\n");
+ IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ /* test file:// scheme */
+ lstrcpyW(file_uri1W, fileW);
+ lstrcatW(file_uri1W, pathW);
+ hwnd = CreateWindowW(cls_names[i], file_uri1W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = NULL;
+ res = AtlAxGetControl(hwnd, &control);
+ ok(res == S_OK, "AtlAxGetControl failed with res %08x\n", res);
+ ok(control != NULL, "AtlAxGetControl failed!\n");
+ IUnknown_Release(control);
+ DestroyWindow(hwnd);
+
+ /* test file:// scheme on non-existent file */
+ ret = DeleteFileW(pathW);
+ ok(ret, "DeleteFile failed!\n");
+ hwnd = CreateWindowW(cls_names[i], file_uri1W, 0, 100, 100, 100, 100, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "CreateWindow failed!\n");
+ control = NULL;
+ res = AtlAxGetControl(hwnd, &control);
+ ok(res == S_OK, "AtlAxGetControl failed with res %08x\n", res);
+ ok(control != NULL, "AtlAxGetControl failed!\n");
+ IUnknown_Release(control);
+ DestroyWindow(hwnd);
+ }
+ todo_wine ok(wndproc[0] != wndproc[1], "expected different proc!\n");
}
START_TEST(atl)
More information about the wine-cvs
mailing list