[PATCH] gdi32/tests: Add a context to the testJustification() failure message.

Francois Gouget fgouget at codeweavers.com
Thu Jun 10 07:11:58 CDT 2021


It is called in three places so this allows identifying which one
failed.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
All context strings are unique which is the most important part. But I'm
open to changing them if other values would be more descriptive.
---
 dlls/gdi32/tests/font.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 6bd9c8e941f..19076eab3a5 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -2381,7 +2381,7 @@ static void test_GetOutlineTextMetrics(void)
     ReleaseDC(0, hdc);
 }
 
-static void testJustification(HDC hdc, PCSTR str, RECT *clientArea)
+static void testJustification(const char *context, HDC hdc, PCSTR str, RECT *clientArea)
 {
     INT         y,
                 breakCount,
@@ -2452,8 +2452,8 @@ static void testJustification(HDC hdc, PCSTR str, RECT *clientArea)
         /* The width returned by GetTextExtentPoint32() is exactly the same
            returned by GetTextExtentExPointW() - see dlls/gdi32/font.c */
         ok(error[e].GetTextExtentExPointWWidth == areaWidth,
-            "GetTextExtentPointW() for \"%.*s\" should have returned a width of %d, not %d.\n",
-           error[e].len, error[e].start, areaWidth, error[e].GetTextExtentExPointWWidth);
+            "%s: GetTextExtentPointW() for \"%.*s\" should have returned a width of %d, not %d.\n",
+           context, error[e].len, error[e].start, areaWidth, error[e].GetTextExtentExPointWWidth);
     }
 }
 
@@ -2496,7 +2496,7 @@ static void test_SetTextJustification(void)
     hfont = create_font("Times New Roman", &lf);
     SelectObject(hdc, hfont);
 
-    testJustification(hdc, testText, &clientArea);
+    testJustification("default", hdc, testText, &clientArea);
 
     if (!pGetTextExtentExPointI) goto done;
     GetGlyphIndicesA( hdc, "A ", 2, indices, 0 );
@@ -2533,7 +2533,7 @@ static void test_SetTextJustification(void)
     SetWindowExtEx( hdc, 2, 2, NULL );
     GetClientRect( hwnd, &clientArea );
     DPtoLP( hdc, (POINT *)&clientArea, 2 );
-    testJustification(hdc, testText, &clientArea);
+    testJustification("2x2", hdc, testText, &clientArea);
 
     GetTextExtentPoint32A(hdc, "A", 1, &expect);
     for (i = 0; i < 10; i++)
@@ -2555,7 +2555,7 @@ static void test_SetTextJustification(void)
     SetViewportExtEx( hdc, 3, 3, NULL );
     GetClientRect( hwnd, &clientArea );
     DPtoLP( hdc, (POINT *)&clientArea, 2 );
-    testJustification(hdc, testText, &clientArea);
+    testJustification("3x3", hdc, testText, &clientArea);
 
     GetTextExtentPoint32A(hdc, "A", 1, &expect);
     for (i = 0; i < 10; i++)
-- 
2.20.1



More information about the wine-devel mailing list