Thomas Faber : shell32/tests: Test that shell view windows reference their shell view.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jul 7 08:11:58 CDT 2015
Module: wine
Branch: master
Commit: 360cf273ae93bc8c37152b0518739648a074f596
URL: http://source.winehq.org/git/wine.git/?a=commit;h=360cf273ae93bc8c37152b0518739648a074f596
Author: Thomas Faber <thomas.faber at reactos.org>
Date: Mon Jul 6 22:23:49 2015 +0200
shell32/tests: Test that shell view windows reference their shell view.
---
dlls/shell32/tests/shlview.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c
index 2134a49..8b2b5b4 100644
--- a/dlls/shell32/tests/shlview.c
+++ b/dlls/shell32/tests/shlview.c
@@ -634,6 +634,7 @@ static void test_CreateViewWindow(void)
IDropTarget *dt;
HRESULT hr;
RECT r = {0};
+ ULONG ref1, ref2;
hr = SHGetDesktopFolder(&desktop);
ok(hr == S_OK, "got (0x%08x)\n", hr);
@@ -676,11 +677,29 @@ if (0)
ok(hr == S_OK, "got (0x%08x)\n", hr);
IDropTarget_Release(dt);
+ IShellView_AddRef(view);
+ ref1 = IShellView_Release(view);
hr = IShellView_DestroyViewWindow(view);
ok(hr == S_OK, "got (0x%08x)\n", hr);
ok(!IsWindow(hwnd_view), "hwnd %p still valid\n", hwnd_view);
+ ref2 = IShellView_Release(view);
+ ok(ref1 > ref2, "expected %u > %u\n", ref1, ref2);
+ ref1 = ref2;
+
+ /* Show that releasing the shell view does not destroy the window */
+ hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
+ ok(hr == S_OK, "got (0x%08x)\n", hr);
+ hwnd_view = NULL;
+ hr = IShellView_CreateViewWindow(view, NULL, &settings, &test_shellbrowser, &r, &hwnd_view);
+ ok(hr == S_OK || broken(hr == S_FALSE), "got (0x%08x)\n", hr);
+ ok(hwnd_view != NULL, "got %p\n", hwnd_view);
+ ok(IsWindow(hwnd_view), "hwnd %p still valid\n", hwnd_view);
+ ref2 = IShellView_Release(view);
+ ok(ref2 != 0, "ref2 = %u\n", ref2);
+ ok(ref2 > ref1, "expected %u > %u\n", ref2, ref1);
+ ok(IsWindow(hwnd_view), "hwnd %p still valid\n", hwnd_view);
+ DestroyWindow(hwnd_view);
- IShellView_Release(view);
IShellFolder_Release(desktop);
}
More information about the wine-cvs
mailing list