mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:42:58 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
105
modules/rostests/apitests/shell32/CMyComputer.cpp
Normal file
105
modules/rostests/apitests/shell32/CMyComputer.cpp
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
|
||||
* PURPOSE: Test for CMyComputer
|
||||
* PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
|
||||
*/
|
||||
|
||||
#include "shelltest.h"
|
||||
#include <atlbase.h>
|
||||
#include <atlcom.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
#include <shellutils.h>
|
||||
|
||||
static
|
||||
VOID
|
||||
TestShellFolder(
|
||||
_In_ IShellFolder2 *psf2)
|
||||
{
|
||||
HRESULT hr;
|
||||
CComPtr<IDropTarget> pdt;
|
||||
CComPtr<IDropTarget> pdt_2;
|
||||
CComPtr<IContextMenu> pcm;
|
||||
CComPtr<IContextMenu> pcm_2;
|
||||
CComPtr<IShellView> psv;
|
||||
CComPtr<IShellView> psv_2;
|
||||
|
||||
hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget, &pdt));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
|
||||
hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IDropTarget, &pdt_2));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
ok(pdt != pdt_2, "Expected %p != %p\n", static_cast<PVOID>(pdt), static_cast<PVOID>(pdt_2));
|
||||
|
||||
hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IContextMenu, &pcm));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
|
||||
hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IContextMenu, &pcm_2));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
ok(pcm != pcm_2, "Expected %p != %p\n", static_cast<PVOID>(pcm), static_cast<PVOID>(pcm_2));
|
||||
|
||||
hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IShellView, &psv));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
|
||||
hr = psf2->CreateViewObject(NULL, IID_PPV_ARG(IShellView, &psv_2));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
ok(psv != psv_2, "Expected %p != %p\n", static_cast<PVOID>(psv), static_cast<PVOID>(psv_2));
|
||||
}
|
||||
|
||||
VOID TestInitialize(_In_ IShellFolder2 *psf2)
|
||||
{
|
||||
CComPtr<IPersistFolder2> ppf2;
|
||||
HRESULT hr = psf2->QueryInterface(IID_PPV_ARG(IPersistFolder2, &ppf2));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
|
||||
hr = ppf2->Initialize(NULL);
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
|
||||
hr = ppf2->Initialize((LPCITEMIDLIST)0xdeaddead);
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
|
||||
//crashes in xp
|
||||
//hr = ppf2->GetCurFolder(NULL);
|
||||
//ok(hr == E_INVALIDARG, "hr = %lx\n", hr);
|
||||
|
||||
LPITEMIDLIST pidl;
|
||||
hr = ppf2->GetCurFolder(&pidl);
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
// 0 in win10, 14 in xp
|
||||
ok(pidl->mkid.cb == 0x14, "expected empty pidl got cb = %x\n", pidl->mkid.cb);
|
||||
}
|
||||
|
||||
START_TEST(CMyComputer)
|
||||
{
|
||||
HRESULT hr;
|
||||
CComPtr<IShellFolder2> psf2;
|
||||
CComPtr<IShellFolder2> psf2_2;
|
||||
CComPtr<IShellFolder> psf;
|
||||
|
||||
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||
|
||||
hr = CoCreateInstance(CLSID_MyComputer,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IShellFolder2, &psf2));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
skip("Could not instantiate CShellDesktop\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* second create should give us a pointer to the same object */
|
||||
hr = CoCreateInstance(CLSID_MyComputer,
|
||||
NULL,
|
||||
CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARG(IShellFolder2, &psf2_2));
|
||||
ok(hr == S_OK, "hr = %lx\n", hr);
|
||||
ok(psf2 == psf2_2, "Expected %p == %p\n", static_cast<PVOID>(psf2), static_cast<PVOID>(psf2_2));
|
||||
|
||||
TestShellFolder(psf2);
|
||||
TestInitialize(psf2);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue