Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
19fe3f0c
Commit
19fe3f0c
authored
Dec 16, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/tests: Add tests for device capabilities on memory DCs.
parent
d77f0ae7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
1 deletion
+92
-1
dc.c
dlls/gdi32/tests/dc.c
+92
-1
No files found.
dlls/gdi32/tests/dc.c
View file @
19fe3f0c
...
...
@@ -263,13 +263,98 @@ static void test_GdiConvertToDevmodeW(void)
HeapFree
(
GetProcessHeap
(),
0
,
dmW
);
}
static
void
test_device_caps
(
HDC
hdc
,
HDC
ref_dc
,
const
char
*
descr
)
{
static
const
int
caps
[]
=
{
DRIVERVERSION
,
TECHNOLOGY
,
HORZSIZE
,
VERTSIZE
,
HORZRES
,
VERTRES
,
BITSPIXEL
,
PLANES
,
NUMBRUSHES
,
NUMPENS
,
NUMMARKERS
,
NUMFONTS
,
NUMCOLORS
,
PDEVICESIZE
,
CURVECAPS
,
LINECAPS
,
POLYGONALCAPS
,
TEXTCAPS
,
CLIPCAPS
,
RASTERCAPS
,
ASPECTX
,
ASPECTY
,
ASPECTXY
,
LOGPIXELSX
,
LOGPIXELSY
,
SIZEPALETTE
,
NUMRESERVED
,
COLORRES
,
PHYSICALWIDTH
,
PHYSICALHEIGHT
,
PHYSICALOFFSETX
,
PHYSICALOFFSETY
,
SCALINGFACTORX
,
SCALINGFACTORY
,
VREFRESH
,
DESKTOPVERTRES
,
DESKTOPHORZRES
,
BLTALIGNMENT
,
SHADEBLENDCAPS
,
COLORMGMTCAPS
};
unsigned
int
i
;
if
(
GetObjectType
(
hdc
)
==
OBJ_METADC
)
for
(
i
=
0
;
i
<
sizeof
(
caps
)
/
sizeof
(
caps
[
0
]);
i
++
)
ok
(
GetDeviceCaps
(
hdc
,
caps
[
i
]
)
==
(
caps
[
i
]
==
TECHNOLOGY
?
DT_METAFILE
:
0
),
"wrong caps on %s for %u: %u
\n
"
,
descr
,
caps
[
i
],
GetDeviceCaps
(
hdc
,
caps
[
i
]
)
);
else
for
(
i
=
0
;
i
<
sizeof
(
caps
)
/
sizeof
(
caps
[
0
]);
i
++
)
ok
(
GetDeviceCaps
(
hdc
,
caps
[
i
]
)
==
GetDeviceCaps
(
ref_dc
,
caps
[
i
]
),
"mismatched caps on %s for %u: %u/%u
\n
"
,
descr
,
caps
[
i
],
GetDeviceCaps
(
hdc
,
caps
[
i
]
),
GetDeviceCaps
(
ref_dc
,
caps
[
i
]
)
);
if
(
GetObjectType
(
hdc
)
==
OBJ_MEMDC
)
{
char
buffer
[
sizeof
(
BITMAPINFOHEADER
)
+
256
*
sizeof
(
RGBQUAD
)];
BITMAPINFO
*
info
=
(
BITMAPINFO
*
)
buffer
;
HBITMAP
dib
,
old
;
memset
(
buffer
,
0
,
sizeof
(
buffer
)
);
info
->
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
info
->
bmiHeader
.
biWidth
=
16
;
info
->
bmiHeader
.
biHeight
=
16
;
info
->
bmiHeader
.
biPlanes
=
1
;
info
->
bmiHeader
.
biBitCount
=
8
;
info
->
bmiHeader
.
biCompression
=
BI_RGB
;
dib
=
CreateDIBSection
(
ref_dc
,
info
,
DIB_RGB_COLORS
,
NULL
,
NULL
,
0
);
old
=
SelectObject
(
hdc
,
dib
);
for
(
i
=
0
;
i
<
sizeof
(
caps
)
/
sizeof
(
caps
[
0
]);
i
++
)
ok
(
GetDeviceCaps
(
hdc
,
caps
[
i
]
)
==
GetDeviceCaps
(
ref_dc
,
caps
[
i
]
),
"mismatched caps on %s and DIB for %u: %u/%u
\n
"
,
descr
,
caps
[
i
],
GetDeviceCaps
(
hdc
,
caps
[
i
]
),
GetDeviceCaps
(
ref_dc
,
caps
[
i
]
)
);
SelectObject
(
hdc
,
old
);
DeleteObject
(
dib
);
}
}
static
void
test_CreateCompatibleDC
(
void
)
{
BOOL
bRet
;
HDC
hdc
,
hNewDC
,
hdcMetafile
;
HDC
hdc
,
hNewDC
,
hdcMetafile
,
screen_dc
;
HBITMAP
bitmap
;
INT
caps
;
screen_dc
=
GetDC
(
0
);
bitmap
=
CreateBitmap
(
10
,
10
,
1
,
1
,
NULL
);
/* Create a DC compatible with the screen */
...
...
@@ -279,6 +364,8 @@ static void test_CreateCompatibleDC(void)
caps
=
GetDeviceCaps
(
hdc
,
TECHNOLOGY
);
ok
(
caps
==
DT_RASDISPLAY
,
"wrong caps %u
\n
"
,
caps
);
test_device_caps
(
hdc
,
screen_dc
,
"display dc"
);
/* Delete this DC, this should succeed */
bRet
=
DeleteDC
(
hdc
);
ok
(
bRet
==
TRUE
,
"DeleteDC returned %u
\n
"
,
bRet
);
...
...
@@ -307,9 +394,11 @@ static void test_CreateCompatibleDC(void)
ok
(
hNewDC
==
NULL
,
"CreateCompatibleDC succeeded
\n
"
);
caps
=
GetDeviceCaps
(
hdcMetafile
,
TECHNOLOGY
);
ok
(
caps
==
DT_METAFILE
,
"wrong caps %u
\n
"
,
caps
);
test_device_caps
(
hdcMetafile
,
screen_dc
,
"metafile dc"
);
DeleteMetaFile
(
CloseMetaFile
(
hdcMetafile
));
DeleteObject
(
bitmap
);
ReleaseDC
(
0
,
screen_dc
);
}
static
void
test_DC_bitmap
(
void
)
...
...
@@ -856,6 +945,8 @@ static void test_printer_dc(void)
ret
=
GetDeviceCaps
(
display_memdc
,
TECHNOLOGY
);
ok
(
ret
==
DT_RASDISPLAY
,
"wrong type %u
\n
"
,
ret
);
test_device_caps
(
memdc
,
hdc
,
"printer dc"
);
bmp
=
CreateBitmap
(
100
,
100
,
1
,
GetDeviceCaps
(
hdc
,
BITSPIXEL
),
NULL
);
orig
=
SelectObject
(
memdc
,
bmp
);
ok
(
orig
!=
NULL
,
"SelectObject failed
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment