[PATCH 1/6] riched20/tests: Add tests to check the content open by, ITextDocument_fnOpen.
Jactry Zeng
jactry92 at gmail.com
Tue Feb 11 12:05:04 CST 2014
Hello folks,
This series of patches is the implementation of ITextDocument_Open which
was the proposal of my GSoC 2013. Because of my school work I had little
time for it after GSoC.
This time I add more testcase for it (patch one).
Patch two is the basic implementaion.
In patch three to six add more flag support.
I appreciate for any comment! :)
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140212/e662d081/attachment.html>
-------------- next part --------------
From 7ffcca215d0342f56fa1131aac66b0de384839a3 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <jactry92 at gmail.com>
Date: Tue, 11 Feb 2014 19:05:33 +0800
Subject: [PATCH 1/6] riched20/tests: Add tests to check the content open by
ITextDocument_fnOpen.
---
dlls/riched20/tests/richole.c | 50 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 63208ee..3781e68 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -159,6 +159,16 @@ static void test_ITextDocument_Open(void)
HANDLE hFile;
VARIANT testfile;
WCHAR filename[] = {'t', 'e', 's', 't','.','t','x','t', 0};
+ int result;
+ DWORD dw;
+ static const CHAR chACP[] = "TestSomeText";
+ static const CHAR chUTF8[] = "\xef\xbb\xbfTextWithUTF8BOM";
+ static const WCHAR chUTF16[] = {0xfeff, 'T', 'e', 's', 't', 'S', 'o', 'm',
+ 'e', 'T', 'e', 'x', 't', 0};
+
+#define MAX_BUF_LEN 1024
+ CHAR bufACP[MAX_BUF_LEN];
+ WCHAR bufUnicode[MAX_BUF_LEN];
static const int tomConstantsSingle[] =
{
@@ -328,6 +338,46 @@ static void test_ITextDocument_Open(void)
CloseHandle(hFile);
release_interfaces(&w, &reOle, &txtDoc, &txtSel);
DeleteFileW(filename);
+
+ /* tests to check the content */
+ hFile = CreateFileW(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ WriteFile(hFile, chACP, sizeof(chACP)-sizeof(CHAR), &dw, NULL);
+ CloseHandle(hFile);
+ create_interfaces(&w, &reOle, &txtDoc, &txtSel);
+ ITextDocument_Open(txtDoc, &testfile, tomReadOnly, CP_ACP);
+ result = SendMessageA(w, WM_GETTEXT, 1024, (LPARAM)bufACP);
+ todo_wine ok(result == 12, "ITextDocument_Open: Test ASCII returned %d, expected 12\n", result);
+ result = strcmp(bufACP, chACP);
+ todo_wine ok(result == 0, "ITextDocument_Open: Test ASCII set wrong text: Result: %s\n", bufACP);
+ release_interfaces(&w, &reOle, &txtDoc, &txtSel);
+ DeleteFileW(filename);
+
+ hFile = CreateFileW(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ WriteFile(hFile, chUTF8, sizeof(chUTF8)-sizeof(CHAR), &dw, NULL);
+ CloseHandle(hFile);
+ create_interfaces(&w, &reOle, &txtDoc, &txtSel);
+ ITextDocument_Open(txtDoc, &testfile, tomReadOnly, CP_UTF8);
+ result = SendMessageA(w, WM_GETTEXT, 1024, (LPARAM)bufACP);
+ todo_wine ok(result == 15, "ITextDocument_Open: Test UTF-8 returned %d, expected 15\n", result);
+ result = strcmp(bufACP, &chUTF8[3]);
+ todo_wine ok(result == 0, "ITextDocument_Open: Test UTF-8 set wrong text: Result: %s\n", bufACP);
+ release_interfaces(&w, &reOle, &txtDoc, &txtSel);
+ DeleteFileW(filename);
+
+ hFile = CreateFileW(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ WriteFile(hFile, chUTF16, sizeof(chUTF16)-sizeof(WCHAR), &dw, NULL);
+ CloseHandle(hFile);
+ create_interfaces(&w, &reOle, &txtDoc, &txtSel);
+ ITextDocument_Open(txtDoc, &testfile, tomReadOnly, 1200);
+ result = SendMessageW(w, WM_GETTEXT, 1024, (LPARAM)bufUnicode);
+ todo_wine ok(result == 12, "ITextDocument_Open: Test UTF-16 returned %d, expected 12\n", result);
+ result = lstrcmpW(bufUnicode, &chUTF16[1]);
+ todo_wine ok(result == 0, "ITextDocument_Open: Test UTF-16 set wrong text: Result: %s\n", wine_dbgstr_w(bufUnicode));
+ release_interfaces(&w, &reOle, &txtDoc, &txtSel);
+ DeleteFileW(filename);
}
START_TEST(richole)
--
1.8.3.2
More information about the wine-patches
mailing list