Zebediah Figura : user32/tests: Relax WindowFromDC() tests a bit.

Alexandre Julliard julliard at winehq.org
Mon Jan 6 15:38:01 CST 2020


Module: wine
Branch: master
Commit: 89d67614ca1d020fae39aa09e852a7e2bea77783
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=89d67614ca1d020fae39aa09e852a7e2bea77783

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jan  6 10:00:00 2020 -0600

user32/tests: Relax WindowFromDC() tests a bit.

Windows often reuses the DC handle for a different window (which may be in
another process).

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/dce.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/user32/tests/dce.c b/dlls/user32/tests/dce.c
index 18ded3357d..017506d9aa 100644
--- a/dlls/user32/tests/dce.c
+++ b/dlls/user32/tests/dce.c
@@ -54,7 +54,7 @@ static void test_dc_attributes(void)
 
     ok( WindowFromDC( hdc ) == hwnd_cache, "wrong window\n" );
     ReleaseDC( hwnd_cache, hdc );
-    ok( WindowFromDC( hdc ) == 0, "wrong window\n" );
+    ok( WindowFromDC( hdc ) != hwnd_cache, "wrong window\n" );
     hdc = GetDC( hwnd_cache );
     rop = GetROP2( hdc );
     ok( rop == def_rop, "wrong ROP2 %d after release\n", rop );
@@ -124,7 +124,7 @@ static void test_dc_attributes(void)
     ok( caps == 0, "got %d\n", caps );
     caps = GetDeviceCaps( old_hdc, NUMCOLORS );
     ok( caps == 0, "got %d\n", caps );
-    ok( WindowFromDC( old_hdc ) == 0, "wrong window\n" );
+    ok( WindowFromDC( old_hdc ) != hwnd_cache, "wrong window\n" );
 
     hdc = GetDC(0);
     caps = GetDeviceCaps( hdc, HORZRES );
@@ -645,7 +645,7 @@ static void test_destroyed_window(void)
     DestroyWindow( hwnd_cache );
     rop = GetROP2( dc );
     ok( rop == 0, "wrong ROP2 %d\n", rop );
-    ok( WindowFromDC( dc ) == 0, "wrong window\n" );
+    ok( WindowFromDC( dc ) != hwnd_cache, "wrong window\n" );
     ok( !ReleaseDC( hwnd_cache, dc ), "ReleaseDC succeeded\n" );
     dc = GetDC( hwnd_cache );
     ok( !dc, "Got a non-NULL DC (%p) for a destroyed window\n", dc );
@@ -674,7 +674,7 @@ static void test_destroyed_window(void)
 
     rop = GetROP2( dc );
     ok( rop == R2_WHITE, "wrong ROP2 %d\n", rop );
-    ok( WindowFromDC( dc ) == 0, "wrong window\n" );
+    ok( WindowFromDC( dc ) != hwnd_classdc2, "wrong window\n" );
     ok( !ReleaseDC( hwnd_classdc2, dc ), "ReleaseDC succeeded\n" );
     dc = GetDC( hwnd_classdc2 );
     ok( !dc, "Got a non-NULL DC (%p) for a destroyed window\n", dc );
@@ -688,7 +688,7 @@ static void test_destroyed_window(void)
 
     rop = GetROP2( dc );
     ok( rop == R2_WHITE, "wrong ROP2 %d\n", rop );
-    ok( WindowFromDC( dc ) == 0, "wrong window\n" );
+    ok( WindowFromDC( dc ) != hwnd_classdc, "wrong window\n" );
     ok( !ReleaseDC( hwnd_classdc, dc ), "ReleaseDC succeeded\n" );
     dc = GetDC( hwnd_classdc );
     ok( !dc, "Got a non-NULL DC (%p) for a destroyed window\n", dc );
@@ -702,7 +702,7 @@ static void test_destroyed_window(void)
 
     rop = GetROP2( dc );
     ok( rop == 0, "wrong ROP2 %d\n", rop );
-    ok( WindowFromDC( dc ) == 0, "wrong window\n" );
+    ok( WindowFromDC( dc ) != hwnd_owndc, "wrong window\n" );
     ok( !ReleaseDC( hwnd_owndc, dc ), "ReleaseDC succeeded\n" );
     dc = GetDC( hwnd_owndc );
     ok( !dc, "Got a non-NULL DC (%p) for a destroyed window\n", dc );




More information about the wine-cvs mailing list