Module: wine Branch: master Commit: edf0635ed4350973924407c71b1dbfad2f9d2416 URL: https://gitlab.winehq.org/wine/wine/-/commit/edf0635ed4350973924407c71b1dbfa...
Author: Bernhard Übelacker bernhardu@mailbox.org Date: Sun Jan 14 10:20:16 2024 +0100
wing32: Add tests.
---
configure | 1 + configure.ac | 1 + dlls/wing32/Makefile.in | 1 + dlls/wing32/tests/Makefile.in | 5 ++++ dlls/wing32/tests/wing32.c | 64 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+)
diff --git a/configure b/configure index e30aed5f408..3939f1873a4 100755 --- a/configure +++ b/configure @@ -22440,6 +22440,7 @@ wine_fn_config_makefile dlls/winex11.drv enable_winex11_drv wine_fn_config_makefile dlls/winexinput.sys enable_winexinput_sys wine_fn_config_makefile dlls/wing.dll16 enable_win16 wine_fn_config_makefile dlls/wing32 enable_wing32 +wine_fn_config_makefile dlls/wing32/tests enable_tests wine_fn_config_makefile dlls/winhttp enable_winhttp wine_fn_config_makefile dlls/winhttp/tests enable_tests wine_fn_config_makefile dlls/wininet enable_wininet diff --git a/configure.ac b/configure.ac index cba55126869..9488b3263cc 100644 --- a/configure.ac +++ b/configure.ac @@ -3257,6 +3257,7 @@ WINE_CONFIG_MAKEFILE(dlls/winex11.drv) WINE_CONFIG_MAKEFILE(dlls/winexinput.sys) WINE_CONFIG_MAKEFILE(dlls/wing.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/wing32) +WINE_CONFIG_MAKEFILE(dlls/wing32/tests) WINE_CONFIG_MAKEFILE(dlls/winhttp) WINE_CONFIG_MAKEFILE(dlls/winhttp/tests) WINE_CONFIG_MAKEFILE(dlls/wininet) diff --git a/dlls/wing32/Makefile.in b/dlls/wing32/Makefile.in index 833e62e8d8e..e4da7836632 100644 --- a/dlls/wing32/Makefile.in +++ b/dlls/wing32/Makefile.in @@ -1,4 +1,5 @@ MODULE = wing32.dll +IMPORTLIB = wing32 IMPORTS = user32 gdi32
SOURCES = \ diff --git a/dlls/wing32/tests/Makefile.in b/dlls/wing32/tests/Makefile.in new file mode 100644 index 00000000000..395a9f4706a --- /dev/null +++ b/dlls/wing32/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = wing32.dll +IMPORTS = wing32 gdi32 + +SOURCES = \ + wing32.c diff --git a/dlls/wing32/tests/wing32.c b/dlls/wing32/tests/wing32.c new file mode 100644 index 00000000000..1a3c958ff02 --- /dev/null +++ b/dlls/wing32/tests/wing32.c @@ -0,0 +1,64 @@ +/* + * Unit test suite for wing32 functions + * + * Copyright 2024 Bernhard Übelacker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <windows.h> + +#include "wine/test.h" + +HDC WINAPI WinGCreateDC(void); +HBITMAP WINAPI WinGCreateBitmap(HDC, BITMAPINFO*, void **); +void* WINAPI WinGGetDIBPointer(HBITMAP, BITMAPINFO*); + +static void test_WinGGetDIBPointer(void) +{ + HDC dc; + BITMAPINFO bmi; + void *bits; + HBITMAP bmp; + void* dib; + + dc = WinGCreateDC(); + ok(dc != NULL, "WinGCreateDC failed\n"); + + memset(&bmi, 0, sizeof(bmi)); + bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); + bmi.bmiHeader.biWidth = 1; + bmi.bmiHeader.biHeight = 1; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount= 24; + bmi.bmiHeader.biCompression= BI_RGB; + bmi.bmiHeader.biSizeImage = 0; + bmp = WinGCreateBitmap(dc, &bmi, &bits); + ok(bmp != NULL, "WinGCreateBitmap failed\n"); + + dib = WinGGetDIBPointer(NULL, NULL); + ok(dib == NULL, "WinGGetDIBPointer returned unexpected value %p\n", dib); + + dib = WinGGetDIBPointer(bmp, &bmi); + ok(dib != NULL, "WinGGetDIBPointer failed\n"); + + DeleteObject(bmp); + DeleteDC(dc); +} + +START_TEST(wing32) +{ + test_WinGGetDIBPointer(); +}