mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 04:14:53 +00:00
[user32_apitest]
- Add some tests to see how SetCursorPos is affected by the current desktop svn path=/trunk/; revision=57656
This commit is contained in:
parent
5b99cd433d
commit
d93c98ed58
1 changed files with 41 additions and 0 deletions
|
@ -159,7 +159,48 @@ void Test_SetCursorPos()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Test_DesktopAccess()
|
||||||
|
{
|
||||||
|
HDESK hDesk, hDeskInitial;
|
||||||
|
POINT curPoint, initialPoint;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
hDeskInitial = GetThreadDesktop(GetCurrentThreadId());
|
||||||
|
ok(hDeskInitial != NULL, "Failed to retrieve the initial desktop\n");
|
||||||
|
|
||||||
|
ret = GetCursorPos(&initialPoint);
|
||||||
|
ok(ret == TRUE, "GetCursorPos should succed\n");
|
||||||
|
|
||||||
|
hDesk = CreateDesktopW(L"testDesktop", NULL, NULL, 0, 0x01ff, NULL);
|
||||||
|
ok(hDesk != 0, "Failed to create a new desktop\n");
|
||||||
|
SetThreadDesktop(hDesk);
|
||||||
|
ok(GetThreadDesktop(GetCurrentThreadId()) == hDesk, "SetThreadDesktop had no effect\n");
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
|
||||||
|
ret = GetCursorPos(&curPoint);
|
||||||
|
ok(ret == FALSE, "GetCursorPos should fail\n");
|
||||||
|
|
||||||
|
ok(GetLastError() == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED got 0x%lu\n", GetLastError());
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
|
||||||
|
ret = SetCursorPos(2,2);
|
||||||
|
ok(ret == FALSE, "SetCursorPos should fail\n");
|
||||||
|
|
||||||
|
ok(GetLastError() == 0xdeadbeef, "Wrong last error, got 0x%lu\n", GetLastError());
|
||||||
|
|
||||||
|
ret = GetCursorPos(&curPoint);
|
||||||
|
ok(ret == FALSE, "GetCursorPos should fail\n");
|
||||||
|
|
||||||
|
SetThreadDesktop(hDeskInitial);
|
||||||
|
|
||||||
|
ret = GetCursorPos(&curPoint);
|
||||||
|
ok(ret == TRUE, "GetCursorPos should succed\n");
|
||||||
|
ok(curPoint.x == initialPoint.x && curPoint.y == initialPoint.y, "Mouse position changed\n");
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(SetCursorPos)
|
START_TEST(SetCursorPos)
|
||||||
{
|
{
|
||||||
|
Test_DesktopAccess();
|
||||||
Test_SetCursorPos();
|
Test_SetCursorPos();
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue