Nikolay Sivov : usp10/tests: Simple ScriptString_pSize() test.

Alexandre Julliard julliard at winehq.org
Mon Oct 2 15:46:23 CDT 2017


Module: wine
Branch: master
Commit: 82ed7410cb3cdd38b1aaa89678b10cd2f18fcb6f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=82ed7410cb3cdd38b1aaa89678b10cd2f18fcb6f

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Oct  2 10:46:58 2017 +0300

usp10/tests: Simple ScriptString_pSize() test.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/usp10/tests/usp10.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 4d8d6a7..47f83ee 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -3173,7 +3173,7 @@ static void test_ScriptString(HDC hdc)
  * This set of tests are for the string functions of uniscribe.  The ScriptStringAnalyse
  * function allocates memory pointed to by the SCRIPT_STRING_ANALYSIS ssa pointer.  This
  * memory is freed by ScriptStringFree.  There needs to be a valid hdc for this as
- * ScriptStringAnalyse calls ScriptSItemize, ScriptShape and ScriptPlace which require it.
+ * ScriptStringAnalyse calls ScriptItemize, ScriptShape and ScriptPlace which require it.
  *
  */
 
@@ -4048,6 +4048,36 @@ static void test_ScriptIsComplex(void)
     ok(hr == S_FALSE, "got 0x%08x\n", hr);
 }
 
+static void test_ScriptString_pSize(HDC hdc)
+{
+    static const WCHAR textW[] = {'A',0};
+    SCRIPT_STRING_ANALYSIS ssa;
+    const SIZE *size;
+    TEXTMETRICW tm;
+    HRESULT hr;
+    ABC abc;
+
+    hr = ScriptStringAnalyse(hdc, textW, 1, 16, -1, SSA_GLYPHS, 0, NULL, NULL, NULL, NULL, NULL, &ssa);
+    ok(hr == S_OK, "ScriptStringAnalyse failed, hr %#x.\n", hr);
+
+    size = ScriptString_pSize(NULL);
+    ok(size == NULL || broken(size != NULL) /* <win7 */, "Unexpected size pointer.\n");
+
+    GetCharABCWidthsW(hdc, textW[0], textW[0], &abc);
+
+    memset(&tm, 0, sizeof(tm));
+    GetTextMetricsW(hdc, &tm);
+    ok(tm.tmHeight > 0, "Unexpected tmHeight.\n");
+
+    size = ScriptString_pSize(ssa);
+    ok(size != NULL, "Unexpected size pointer.\n");
+    ok(size->cx == abc.abcA + abc.abcB + abc.abcC, "Unexpected cx size %d.\n", size->cx);
+    ok(size->cy == tm.tmHeight, "Unexpected cy size %d.\n", size->cy);
+
+    hr = ScriptStringFree(&ssa);
+    ok(hr == S_OK, "Failed to free ssa, hr %#x.\n", hr);
+}
+
 static void init_tests(void)
 {
     HMODULE module = GetModuleHandleA("usp10.dll");
@@ -4109,6 +4139,7 @@ START_TEST(usp10)
     test_ScriptXtoX();
     test_ScriptString(hdc);
     test_ScriptStringXtoCP_CPtoX(hdc);
+    test_ScriptString_pSize(hdc);
 
     test_ScriptLayout();
     test_digit_substitution();




More information about the wine-cvs mailing list