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
02eda5cc
Commit
02eda5cc
authored
Jul 18, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Add some tests for last error with an invalid DC.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a8b5fdda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
opengl.c
dlls/opengl32/tests/opengl.c
+27
-2
wgl.c
dlls/opengl32/wgl.c
+7
-2
No files found.
dlls/opengl32/tests/opengl.c
View file @
02eda5cc
...
...
@@ -397,6 +397,30 @@ static void test_setpixelformat(HDC winhdc)
ok
(
i
==
pf
,
"GetPixelFormat returned wrong format %d/%d
\n
"
,
i
,
pf
);
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
/* check various calls with invalid hdc */
SetLastError
(
0xdeadbeef
);
i
=
GetPixelFormat
(
hdc
);
ok
(
i
==
0
,
"GetPixelFormat succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PIXEL_FORMAT
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
res
=
SetPixelFormat
(
hdc
,
pf
,
&
pfd
);
ok
(
i
==
0
,
"SetPixelFormat succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
res
=
DescribePixelFormat
(
hdc
,
0
,
0
,
NULL
);
ok
(
!
res
,
"DescribePixelFormat succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
pf
=
ChoosePixelFormat
(
hdc
,
&
pfd
);
ok
(
!
pf
,
"ChoosePixelFormat succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
res
=
SwapBuffers
(
hdc
);
ok
(
!
res
,
"SwapBuffers succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ok
(
!
wglCreateContext
(
hdc
),
"CreateContext succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"wrong error %u
\n
"
,
GetLastError
()
);
}
hwnd
=
CreateWindowA
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
,
10
,
10
,
200
,
200
,
NULL
,
NULL
,
...
...
@@ -986,7 +1010,8 @@ static void test_opengl3(HDC hdc)
gl3Ctx
=
pwglCreateContextAttribsARB
((
HDC
)
0xdeadbeef
,
0
,
0
);
ok
(
gl3Ctx
==
0
,
"pwglCreateContextAttribsARB using an invalid HDC passed
\n
"
);
error
=
GetLastError
();
ok
(
error
==
ERROR_DC_NOT_FOUND
||
ok
(
error
==
ERROR_DC_NOT_FOUND
||
error
==
ERROR_INVALID_HANDLE
||
broken
(
error
==
ERROR_DS_GENERIC_ERROR
)
||
broken
(
error
==
NVIDIA_HRESULT_FROM_WIN32
(
ERROR_INVALID_DATA
)),
/* Nvidia Vista + Win7 */
"Expected ERROR_DC_NOT_FOUND, got error=%x
\n
"
,
error
);
wglDeleteContext
(
gl3Ctx
);
...
...
@@ -1001,7 +1026,7 @@ static void test_opengl3(HDC hdc)
ok
(
gl3Ctx
==
0
,
"pwglCreateContextAttribsARB using an invalid shareList passed
\n
"
);
error
=
GetLastError
();
/* The Nvidia implementation seems to return hresults instead of win32 error codes */
ok
(
error
==
ERROR_INVALID_OPERATION
||
ok
(
error
==
ERROR_INVALID_OPERATION
||
error
==
ERROR_INVALID_DATA
||
error
==
NVIDIA_HRESULT_FROM_WIN32
(
ERROR_INVALID_OPERATION
),
"Expected ERROR_INVALID_OPERATION, got error=%x
\n
"
,
error
);
wglDeleteContext
(
gl3Ctx
);
}
...
...
dlls/opengl32/wgl.c
View file @
02eda5cc
...
...
@@ -98,7 +98,8 @@ static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
static
inline
struct
opengl_funcs
*
get_dc_funcs
(
HDC
hdc
)
{
struct
opengl_funcs
*
funcs
=
__wine_get_wgl_driver
(
hdc
,
WINE_WGL_DRIVER_VERSION
);
if
(
funcs
==
(
void
*
)
-
1
)
funcs
=
&
null_opengl_funcs
;
if
(
!
funcs
)
SetLastError
(
ERROR_INVALID_HANDLE
);
else
if
(
funcs
==
(
void
*
)
-
1
)
funcs
=
&
null_opengl_funcs
;
return
funcs
;
}
...
...
@@ -619,7 +620,11 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
INT
WINAPI
wglGetPixelFormat
(
HDC
hdc
)
{
struct
opengl_funcs
*
funcs
=
get_dc_funcs
(
hdc
);
if
(
!
funcs
)
return
0
;
if
(
!
funcs
)
{
SetLastError
(
ERROR_INVALID_PIXEL_FORMAT
);
return
0
;
}
return
funcs
->
wgl
.
p_wglGetPixelFormat
(
hdc
);
}
...
...
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