kernel32: Additional SetThreadPriorityTest (try 6)
Matt Jones
mattj at google.com
Tue Jul 24 15:25:40 CDT 2007
Reformatted tests to address James' email
-------------- next part --------------
From 8649bd8949dcf622753b5f90da06ef14afa2e0b7 Mon Sep 17 00:00:00 2001
From: Matt Jones <mattj at google.com>
Date: Tue, 24 Jul 2007 13:20:40 -0700
Subject: [PATCH] kernel32: Added test for bad arguments to SetThreadPriority, test for correct error value
---
dlls/kernel32/tests/thread.c | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index bbda00e..6b22c0c 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -542,7 +542,7 @@ static VOID test_thread_priority(void)
HANDLE curthread,access_thread;
DWORD curthreadId,exitCode;
int min_priority=-2,max_priority=2;
- BOOL disabled,rc;
+ BOOL disabled,rc,result;
int i;
curthread=GetCurrentThread();
@@ -588,6 +588,33 @@ #endif
"GetThreadPriority Failed\n");
ok(SetThreadPriority(curthread,0)!=0,"SetThreadPriority Failed\n");
+/* Check that the thread priority is not changed if SetThreadPriority
+ is called with a value outside of the max/min range */
+ SetThreadPriority(curthread,min_priority);
+ SetLastError(0xdeadbeef);
+ result = SetThreadPriority(curthread,min_priority-1);
+
+ todo_wine {
+ ok(result == FALSE, "SetThreadPriority passed with a bad argument\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER,
+ "SetThreadPriority error %d, expected ERROR_INVALID_PARAMETER (87)\n", GetLastError());
+ ok(GetThreadPriority(curthread)==min_priority,
+ "GetThreadPriority didn't return min_priority\n");
+ }
+
+ SetThreadPriority(curthread,max_priority);
+ SetLastError(0xdeadbeef);
+ result = SetThreadPriority(curthread,max_priority+1);
+
+ todo_wine {
+ ok(result == FALSE, "SetThreadPriority passed with a bad argument\n");
+ ok(GetLastError() == ERROR_INVALID_PARAMETER,
+ "SetThreadPriority error %d, expected ERROR_INVALID_PARAMETER (87)\n", GetLastError());
+ ok(GetThreadPriority(curthread)==max_priority,
+ "GetThreadPriority didn't return max_priority\n");
+ }
+
+
/* Check thread priority boost */
if (!pGetThreadPriorityBoost || !pSetThreadPriorityBoost)
return; /* Win9x */
--
1.4.1
More information about the wine-patches
mailing list