ReactOS 0.4.16-dev-197-g92996da
sw_extensions.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * PURPOSE: Tests extensions exposed by the software implementation
5 * PROGRAMMERS: Jérôme Gardou
6 */
7
8#include <windows.h>
9#include <wingdi.h>
10#include <GL/gl.h>
11
12#include "wine/test.h"
13
14START_TEST(sw_extensions)
15{
16 BITMAPINFO biDst;
18 HBITMAP bmpDst, bmpOld;
19 INT nFormats, iPixelFormat, res, i;
21 const char* output;
23 UINT *dstBuffer = NULL;
24
25 memset(&biDst, 0, sizeof(BITMAPINFO));
26 biDst.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
27 biDst.bmiHeader.biWidth = 4;
28 biDst.bmiHeader.biHeight = -4;
29 biDst.bmiHeader.biPlanes = 1;
30 biDst.bmiHeader.biBitCount = 32;
32
33 bmpDst = CreateDIBSection(0, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, NULL, 0);
34
35 bmpOld = SelectObject(hdcDst, bmpDst);
36
37 /* Choose a pixel format */
38 nFormats = DescribePixelFormat(hdcDst, 0, 0, NULL);
39 for(i=1; i<=nFormats; i++)
40 {
41 memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
43
46 (pfd.cColorBits == 32) &&
47 (pfd.cAlphaBits == 8) )
48 {
50 break;
51 }
52 }
53
54 ok(pfd.dwFlags & PFD_GENERIC_FORMAT, "We found a pixel format for drawing to bitmap which is not generic !\n");
55 ok (iPixelFormat >= 1 && iPixelFormat <= nFormats, "Could not find a suitable pixel format.\n");
57 ok (res != 0, "SetPixelFormat failed.\n");
59 ok(Context != NULL, "We failed to create a GL context.\n");
61
62 /* Get the version */
63 output = (const char*)glGetString(GL_VERSION);
64 ok(strcmp(output, "1.1.0") == 0, "Expected version 1.1.0, got \"%s\".\n", output);
65
66 /* Get the extensions list */
67 output = (const char*)glGetString(GL_EXTENSIONS);
68 trace("GL extensions are %s.\n", output);
69 ok (strlen(output) == strlen("GL_WIN_swap_hint GL_EXT_bgra GL_EXT_paletted_texture"), "Wrong extension list : \"%s\".\n", output);
70 ok(strstr(output, "GL_WIN_swap_hint") != NULL, "GL_WIN_swap_hint extension is not present.\n");
71 ok(strstr(output, "GL_EXT_bgra") != NULL, "GL_EXT_bgra extension is not present.\n");
72 ok(strstr(output, "GL_EXT_paletted_texture") != NULL, "GL_EXT_paletted_texture extension is not present.\n");
73
74 /* cleanup */
76 SelectObject(hdcDst, bmpOld);
78}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
#define BI_RGB
Definition: precomp.h:56
#define GL_VERSION
Definition: gl.h:689
#define GL_EXTENSIONS
Definition: gl.h:690
GLAPI const GLubyte *GLAPIENTRY glGetString(GLenum name)
GLuint res
Definition: glext.h:9613
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
unsigned int UINT
Definition: ndis.h:50
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
#define memset(x, y, z)
Definition: compat.h:39
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67
USHORT biBitCount
Definition: precomp.h:46
ULONG biCompression
Definition: precomp.h:47
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
Definition: wgl.c:514
HGLRC WINAPI wglCreateContext(HDC hdc)
Definition: wgl.c:383
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
Definition: wgl.c:650
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
_In_ LONG iPixelFormat
Definition: winddi.h:3488
#define DIB_RGB_COLORS
Definition: wingdi.h:367
BOOL WINAPI SetPixelFormat(_In_ HDC, _In_ int, _In_ const PIXELFORMATDESCRIPTOR *)
#define PFD_SUPPORT_OPENGL
Definition: wingdi.h:306
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI DescribePixelFormat(_In_ HDC hdc, _In_ int iPixelFormat, _In_ UINT nBytes, _Out_writes_bytes_opt_(nBytes) LPPIXELFORMATDESCRIPTOR ppfd)
#define PFD_DRAW_TO_BITMAP
Definition: wingdi.h:304
#define PFD_GENERIC_FORMAT
Definition: wingdi.h:307
BOOL WINAPI DeleteDC(_In_ HDC)
static HDC hdcDst
Definition: xlate.c:32