diff --git a/configure b/configure index f2785a280f5..c9afbc0ab83 100755 --- a/configure +++ b/configure @@ -20756,6 +20756,7 @@ wine_fn_config_makefile dlls/dsuiext enable_dsuiext wine_fn_config_makefile dlls/dswave enable_dswave wine_fn_config_makefile dlls/dswave/tests enable_tests wine_fn_config_makefile dlls/dwmapi enable_dwmapi +wine_fn_config_makefile dlls/dwmapi/tests enable_tests wine_fn_config_makefile dlls/dwrite enable_dwrite wine_fn_config_makefile dlls/dwrite/tests enable_tests wine_fn_config_makefile dlls/dx8vb enable_dx8vb diff --git a/configure.ac b/configure.ac index 0f4b0b817a9..360ef2b11f0 100644 --- a/configure.ac +++ b/configure.ac @@ -3278,6 +3278,7 @@ WINE_CONFIG_MAKEFILE(dlls/dsuiext) WINE_CONFIG_MAKEFILE(dlls/dswave) WINE_CONFIG_MAKEFILE(dlls/dswave/tests) WINE_CONFIG_MAKEFILE(dlls/dwmapi) +WINE_CONFIG_MAKEFILE(dlls/dwmapi/tests) WINE_CONFIG_MAKEFILE(dlls/dwrite) WINE_CONFIG_MAKEFILE(dlls/dwrite/tests) WINE_CONFIG_MAKEFILE(dlls/dx8vb) diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c index 6378a091f0b..8408a2efed1 100644 --- a/dlls/dwmapi/dwmapi_main.c +++ b/dlls/dwmapi/dwmapi_main.c @@ -60,6 +60,9 @@ HRESULT WINAPI DwmIsCompositionEnabled(BOOL *enabled) else TRACE("%p\n", enabled); + if (!enabled) + return E_INVALIDARG; + *enabled = FALSE; return S_OK; } diff --git a/dlls/dwmapi/tests/Makefile.in b/dlls/dwmapi/tests/Makefile.in new file mode 100644 index 00000000000..6c6130401d6 --- /dev/null +++ b/dlls/dwmapi/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = dwmapi.dll +IMPORTS = dwmapi + +C_SRCS = \ + dwmapi.c diff --git a/dlls/dwmapi/tests/dwmapi.c b/dlls/dwmapi/tests/dwmapi.c new file mode 100644 index 00000000000..1904e283bba --- /dev/null +++ b/dlls/dwmapi/tests/dwmapi.c @@ -0,0 +1,39 @@ +/* + * Copyright 2020 Zhiyi Zhang for CodeWeavers + * + * 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 "dwmapi.h" +#include "wine/test.h" + +static void test_DwmIsCompositionEnabled(void) +{ + BOOL enabled; + HRESULT hr; + + hr = DwmIsCompositionEnabled(NULL); + ok(hr == E_INVALIDARG, "Expected %#x, got %#x.\n", E_INVALIDARG, hr); + + enabled = -1; + hr = DwmIsCompositionEnabled(&enabled); + ok(hr == S_OK, "Expected %#x, got %#x.\n", S_OK, hr); + ok(enabled == TRUE || enabled == FALSE, "Got unexpected %#x.\n", enabled); +} + +START_TEST(dwmapi) +{ + test_DwmIsCompositionEnabled(); +}