~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/user32/tests/dce.c

Version: ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * Unit tests for DCE support
  3  *
  4  * Copyright 2005 Alexandre Julliard
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include <assert.h>
 22 #include <stdlib.h>
 23 #include <stdarg.h>
 24 #include <stdio.h>
 25 
 26 #include "windef.h"
 27 #include "winbase.h"
 28 #include "wingdi.h"
 29 #include "winuser.h"
 30 
 31 #include "wine/test.h"
 32 
 33 #ifndef DCX_USESTYLE
 34 #define DCX_USESTYLE         0x00010000
 35 #endif
 36 
 37 static HWND hwnd_cache, hwnd_owndc, hwnd_classdc, hwnd_classdc2;
 38 
 39 /* test behavior of DC attributes with various GetDC/ReleaseDC combinations */
 40 static void test_dc_attributes(void)
 41 {
 42     HDC hdc, old_hdc;
 43     INT rop, def_rop;
 44 
 45     /* test cache DC */
 46 
 47     hdc = GetDC( hwnd_cache );
 48     def_rop = GetROP2( hdc );
 49 
 50     SetROP2( hdc, R2_WHITE );
 51     rop = GetROP2( hdc );
 52     ok( rop == R2_WHITE, "wrong ROP2 %d\n", rop );
 53 
 54     ReleaseDC( hwnd_cache, hdc );
 55     hdc = GetDC( hwnd_cache );
 56     rop = GetROP2( hdc );
 57     ok( rop == def_rop, "wrong ROP2 %d after release\n", rop );
 58     SetROP2( hdc, R2_WHITE );
 59     ReleaseDC( hwnd_cache, hdc );
 60 
 61     hdc = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS );
 62     rop = GetROP2( hdc );
 63     /* Win9x seems to silently ignore DCX_NORESETATTRS */
 64     ok( rop == def_rop || rop == R2_WHITE, "wrong ROP2 %d\n", rop );
 65 
 66     SetROP2( hdc, R2_WHITE );
 67     rop = GetROP2( hdc );
 68     ok( rop == R2_WHITE, "wrong ROP2 %d\n", rop );
 69 
 70     ReleaseDC( hwnd_cache, hdc );
 71     hdc = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS );
 72     rop = GetROP2( hdc );
 73     ok( rop == def_rop || rop == R2_WHITE, "wrong ROP2 %d after release\n", rop );
 74     ReleaseDC( hwnd_cache, hdc );
 75 
 76     hdc = GetDCEx( hwnd_cache, 0, DCX_USESTYLE );
 77     rop = GetROP2( hdc );
 78     ok( rop == def_rop, "wrong ROP2 %d after release\n", rop );
 79     ReleaseDC( hwnd_cache, hdc );
 80 
 81     /* test own DC */
 82 
 83     hdc = GetDC( hwnd_owndc );
 84     SetROP2( hdc, R2_WHITE );
 85     rop = GetROP2( hdc );
 86     ok( rop == R2_WHITE, "wrong ROP2 %d\n", rop );
 87 
 88     old_hdc = hdc;
 89     ReleaseDC( hwnd_owndc, hdc );
 90     hdc = GetDC( hwnd_owndc );
 91     ok( old_hdc == hdc, "didn't get same DC %p/%p\n", old_hdc, hdc );
 92     rop = GetROP2( hdc );
 93     ok( rop == R2_WHITE, "wrong ROP2 %d after release\n", rop );
 94     ReleaseDC( hwnd_owndc, hdc );
 95     rop = GetROP2( hdc );
 96     ok( rop == R2_WHITE, "wrong ROP2 %d after second release\n", rop );
 97 
 98     /* test class DC */
 99 
100     hdc = GetDC( hwnd_classdc );
101     SetROP2( hdc, R2_WHITE );
102     rop = GetROP2( hdc );
103     ok( rop == R2_WHITE, "wrong ROP2 %d\n", rop );
104 
105     old_hdc = hdc;
106     ReleaseDC( hwnd_classdc, hdc );
107     hdc = GetDC( hwnd_classdc );
108     ok( old_hdc == hdc, "didn't get same DC %p/%p\n", old_hdc, hdc );
109     rop = GetROP2( hdc );
110     ok( rop == R2_WHITE, "wrong ROP2 %d after release\n", rop );
111     ReleaseDC( hwnd_classdc, hdc );
112     rop = GetROP2( hdc );
113     ok( rop == R2_WHITE, "wrong ROP2 %d after second release\n", rop );
114 
115     /* test class DC with 2 windows */
116 
117     old_hdc = GetDC( hwnd_classdc );
118     SetROP2( old_hdc, R2_BLACK );
119     hdc = GetDC( hwnd_classdc2 );
120     ok( old_hdc == hdc, "didn't get same DC %p/%p\n", old_hdc, hdc );
121     rop = GetROP2( hdc );
122     ok( rop == R2_BLACK, "wrong ROP2 %d for other window\n", rop );
123     ReleaseDC( hwnd_classdc, old_hdc );
124     ReleaseDC( hwnd_classdc, hdc );
125     rop = GetROP2( hdc );
126     ok( rop == R2_BLACK, "wrong ROP2 %d after release\n", rop );
127 }
128 
129 
130 /* test behavior with various invalid parameters */
131 static void test_parameters(void)
132 {
133     HDC hdc;
134 
135     hdc = GetDC( hwnd_cache );
136     ok( ReleaseDC( hwnd_owndc, hdc ), "ReleaseDC with wrong window should succeed\n" );
137 
138     hdc = GetDC( hwnd_cache );
139     ok( !ReleaseDC( hwnd_cache, 0 ), "ReleaseDC with wrong HDC should fail\n" );
140     ok( ReleaseDC( hwnd_cache, hdc ), "correct ReleaseDC should succeed\n" );
141     ok( !ReleaseDC( hwnd_cache, hdc ), "second ReleaseDC should fail\n" );
142 
143     hdc = GetDC( hwnd_owndc );
144     ok( ReleaseDC( hwnd_cache, hdc ), "ReleaseDC with wrong window should succeed\n" );
145     hdc = GetDC( hwnd_owndc );
146     ok( ReleaseDC( hwnd_owndc, hdc ), "correct ReleaseDC should succeed\n" );
147     ok( ReleaseDC( hwnd_owndc, hdc ), "second ReleaseDC should succeed\n" );
148 
149     hdc = GetDC( hwnd_classdc );
150     ok( ReleaseDC( hwnd_cache, hdc ), "ReleaseDC with wrong window should succeed\n" );
151     hdc = GetDC( hwnd_classdc );
152     ok( ReleaseDC( hwnd_classdc, hdc ), "correct ReleaseDC should succeed\n" );
153     ok( ReleaseDC( hwnd_classdc, hdc ), "second ReleaseDC should succeed\n" );
154 }
155 
156 
157 static void test_dc_visrgn(void)
158 {
159     HDC old_hdc, hdc;
160     HRGN hrgn, hrgn2;
161     RECT rect;
162 
163     /* cache DC */
164 
165     SetRect( &rect, 10, 10, 20, 20 );
166     MapWindowPoints( hwnd_cache, 0, (POINT *)&rect, 2 );
167     hrgn = CreateRectRgnIndirect( &rect );
168     hdc = GetDCEx( hwnd_cache, hrgn, DCX_INTERSECTRGN | DCX_USESTYLE );
169     SetRectEmpty( &rect );
170     GetClipBox( hdc, &rect );
171     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
172         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
173     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
174     ReleaseDC( hwnd_cache, hdc );
175     ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" );
176 
177     /* cache DC with NORESETATTRS */
178 
179     SetRect( &rect, 10, 10, 20, 20 );
180     MapWindowPoints( hwnd_cache, 0, (POINT *)&rect, 2 );
181     hrgn = CreateRectRgnIndirect( &rect );
182     hdc = GetDCEx( hwnd_cache, hrgn, DCX_INTERSECTRGN | DCX_USESTYLE | DCX_NORESETATTRS );
183     SetRectEmpty( &rect );
184     GetClipBox( hdc, &rect );
185     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
186         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
187     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
188     ReleaseDC( hwnd_cache, hdc );
189     ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" );
190     hdc = GetDCEx( hwnd_cache, 0, DCX_USESTYLE | DCX_NORESETATTRS );
191     SetRectEmpty( &rect );
192     GetClipBox( hdc, &rect );
193     ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
194         "clip box sould have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
195     ReleaseDC( hwnd_cache, hdc );
196 
197     /* window DC */
198 
199     SetRect( &rect, 10, 10, 20, 20 );
200     MapWindowPoints( hwnd_owndc, 0, (POINT *)&rect, 2 );
201     hrgn = CreateRectRgnIndirect( &rect );
202     hdc = GetDCEx( hwnd_owndc, hrgn, DCX_INTERSECTRGN | DCX_USESTYLE );
203     SetRectEmpty( &rect );
204     GetClipBox( hdc, &rect );
205     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
206         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
207     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
208     ReleaseDC( hwnd_owndc, hdc );
209     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
210     SetRectEmpty( &rect );
211     GetClipBox( hdc, &rect );
212     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
213         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
214     hdc = GetDCEx( hwnd_owndc, 0, DCX_USESTYLE );
215     SetRectEmpty( &rect );
216     GetClipBox( hdc, &rect );
217     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
218         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
219     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
220     ReleaseDC( hwnd_owndc, hdc );
221     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
222 
223     SetRect( &rect, 20, 20, 30, 30 );
224     MapWindowPoints( hwnd_owndc, 0, (POINT *)&rect, 2 );
225     hrgn2 = CreateRectRgnIndirect( &rect );
226     hdc = GetDCEx( hwnd_owndc, hrgn2, DCX_INTERSECTRGN | DCX_USESTYLE );
227     ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" );
228     SetRectEmpty( &rect );
229     GetClipBox( hdc, &rect );
230     ok( rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30,
231         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
232     ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
233     ReleaseDC( hwnd_owndc, hdc );
234     ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
235     hdc = GetDCEx( hwnd_owndc, 0, DCX_EXCLUDERGN | DCX_USESTYLE );
236     ok( GetRgnBox( hrgn2, &rect ) == ERROR, "region must no longer be valid\n" );
237     SetRectEmpty( &rect );
238     GetClipBox( hdc, &rect );
239     ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30),
240         "clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
241     ReleaseDC( hwnd_owndc, hdc );
242 
243     /* class DC */
244 
245     SetRect( &rect, 10, 10, 20, 20 );
246     MapWindowPoints( hwnd_classdc, 0, (POINT *)&rect, 2 );
247     hrgn = CreateRectRgnIndirect( &rect );
248     hdc = GetDCEx( hwnd_classdc, hrgn, DCX_INTERSECTRGN | DCX_USESTYLE );
249     SetRectEmpty( &rect );
250     GetClipBox( hdc, &rect );
251     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
252         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
253     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
254     ReleaseDC( hwnd_classdc, hdc );
255     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
256     SetRectEmpty( &rect );
257     GetClipBox( hdc, &rect );
258     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
259         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
260 
261     hdc = GetDCEx( hwnd_classdc, 0, DCX_USESTYLE );
262     SetRectEmpty( &rect );
263     GetClipBox( hdc, &rect );
264     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
265         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
266     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
267     ReleaseDC( hwnd_classdc, hdc );
268     ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
269 
270     SetRect( &rect, 20, 20, 30, 30 );
271     MapWindowPoints( hwnd_classdc, 0, (POINT *)&rect, 2 );
272     hrgn2 = CreateRectRgnIndirect( &rect );
273     hdc = GetDCEx( hwnd_classdc, hrgn2, DCX_INTERSECTRGN | DCX_USESTYLE );
274     ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" );
275     SetRectEmpty( &rect );
276     GetClipBox( hdc, &rect );
277     ok( rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30,
278         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
279     ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
280 
281     old_hdc = hdc;
282     hdc = GetDCEx( hwnd_classdc2, 0, DCX_USESTYLE );
283     ok( old_hdc == hdc, "did not get the same hdc %p/%p\n", old_hdc, hdc );
284     ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
285     SetRectEmpty( &rect );
286     GetClipBox( hdc, &rect );
287     ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30),
288         "clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
289     ReleaseDC( hwnd_classdc2, hdc );
290     ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
291     hdc = GetDCEx( hwnd_classdc2, 0, DCX_EXCLUDERGN | DCX_USESTYLE );
292     ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
293     ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30),
294         "clip box must have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
295     ReleaseDC( hwnd_classdc2, hdc );
296 }
297 
298 
299 /* test various BeginPaint/EndPaint behaviors */
300 static void test_begin_paint(void)
301 {
302     HDC old_hdc, hdc;
303     RECT rect;
304     PAINTSTRUCT ps;
305 
306     /* cache DC */
307 
308     /* clear update region */
309     RedrawWindow( hwnd_cache, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
310     SetRect( &rect, 10, 10, 20, 20 );
311     RedrawWindow( hwnd_cache, &rect, 0, RDW_INVALIDATE );
312     hdc = BeginPaint( hwnd_cache, &ps );
313     SetRectEmpty( &rect );
314     GetClipBox( hdc, &rect );
315     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
316         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
317     EndPaint( hwnd_cache, &ps );
318 
319     /* window DC */
320 
321     RedrawWindow( hwnd_owndc, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
322     SetRect( &rect, 10, 10, 20, 20 );
323     RedrawWindow( hwnd_owndc, &rect, 0, RDW_INVALIDATE );
324     hdc = BeginPaint( hwnd_owndc, &ps );
325     SetRectEmpty( &rect );
326     GetClipBox( hdc, &rect );
327     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
328         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
329     ReleaseDC( hwnd_owndc, hdc );
330     SetRectEmpty( &rect );
331     GetClipBox( hdc, &rect );
332     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
333         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
334     ok( GetDC( hwnd_owndc ) == hdc, "got different hdc\n" );
335     SetRectEmpty( &rect );
336     GetClipBox( hdc, &rect );
337     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
338         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
339     EndPaint( hwnd_owndc, &ps );
340     SetRectEmpty( &rect );
341     GetClipBox( hdc, &rect );
342     ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
343         "clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
344     RedrawWindow( hwnd_owndc, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
345     SetRect( &rect, 10, 10, 20, 20 );
346     RedrawWindow( hwnd_owndc, &rect, 0, RDW_INVALIDATE|RDW_ERASE );
347     ok( GetDC( hwnd_owndc ) == hdc, "got different hdc\n" );
348     SetRectEmpty( &rect );
349     GetClipBox( hdc, &rect );
350     ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
351         "clip box should be the whole window %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
352     RedrawWindow( hwnd_owndc, NULL, 0, RDW_ERASENOW );
353     SetRectEmpty( &rect );
354     GetClipBox( hdc, &rect );
355     ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
356         "clip box should still be the whole window %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
357 
358     /* class DC */
359 
360     RedrawWindow( hwnd_classdc, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
361     SetRect( &rect, 10, 10, 20, 20 );
362     RedrawWindow( hwnd_classdc, &rect, 0, RDW_INVALIDATE );
363     hdc = BeginPaint( hwnd_classdc, &ps );
364     SetRectEmpty( &rect );
365     GetClipBox( hdc, &rect );
366     ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
367         "invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
368 
369     old_hdc = hdc;
370     hdc = GetDC( hwnd_classdc2 );
371     ok( old_hdc == hdc, "did not get the same hdc %p/%p\n", old_hdc, hdc );
372     SetRectEmpty( &rect );
373     GetClipBox( hdc, &rect );
374     ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
375         "clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
376 }
377 
378 static void test_invisible_create(void)
379 {
380     HWND hwnd_owndc = CreateWindowA("owndc_class", NULL, WS_OVERLAPPED,
381                                     0, 200, 100, 100,
382                                     0, 0, GetModuleHandleA(0), NULL );
383     HDC dc1, dc2;
384 
385     dc1 = GetDC(hwnd_owndc);
386     dc2 = GetDC(hwnd_owndc);
387 
388     ok(dc1 == dc2, "expected owndc dcs to match\n");
389 
390     ReleaseDC(hwnd_owndc, dc2);
391     ReleaseDC(hwnd_owndc, dc1);
392     DestroyWindow(hwnd_owndc);
393 }
394 
395 START_TEST(dce)
396 {
397     WNDCLASSA cls;
398 
399     cls.style = CS_DBLCLKS;
400     cls.lpfnWndProc = DefWindowProcA;
401     cls.cbClsExtra = 0;
402     cls.cbWndExtra = 0;
403     cls.hInstance = GetModuleHandleA(0);
404     cls.hIcon = 0;
405     cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
406     cls.hbrBackground = GetStockObject(WHITE_BRUSH);
407     cls.lpszMenuName = NULL;
408     cls.lpszClassName = "cache_class";
409     RegisterClassA(&cls);
410     cls.style = CS_DBLCLKS | CS_OWNDC;
411     cls.lpszClassName = "owndc_class";
412     RegisterClassA(&cls);
413     cls.style = CS_DBLCLKS | CS_CLASSDC;
414     cls.lpszClassName = "classdc_class";
415     RegisterClassA(&cls);
416 
417     hwnd_cache = CreateWindowA("cache_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
418                                0, 0, 100, 100,
419                                0, 0, GetModuleHandleA(0), NULL );
420     hwnd_owndc = CreateWindowA("owndc_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
421                                0, 200, 100, 100,
422                                0, 0, GetModuleHandleA(0), NULL );
423     hwnd_classdc = CreateWindowA("classdc_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
424                                  200, 0, 100, 100,
425                                  0, 0, GetModuleHandleA(0), NULL );
426     hwnd_classdc2 = CreateWindowA("classdc_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
427                                   200, 200, 100, 100,
428                                   0, 0, GetModuleHandleA(0), NULL );
429     test_dc_attributes();
430     test_parameters();
431     test_dc_visrgn();
432     test_begin_paint();
433     test_invisible_create();
434 }
435 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.