36 const WCHAR task_name[] = {
'T',
'e',
's',
't',
'i',
'n',
'g', 0};
67 TASK_TRIGGER expected_state)
69 ok(found_state.cbTriggerSize == expected_state.cbTriggerSize,
70 "cbTriggerSize: Found %d but expected %d\n",
71 found_state.cbTriggerSize, expected_state.cbTriggerSize);
73 ok(found_state.Reserved1 == expected_state.Reserved1,
74 "Reserved1: Found %d but expected %d\n",
75 found_state.Reserved1, expected_state.Reserved1);
77 ok(found_state.wBeginYear == expected_state.wBeginYear,
78 "wBeginYear: Found %d but expected %d\n",
79 found_state.wBeginYear, expected_state.wBeginYear);
81 ok(found_state.wBeginMonth == expected_state.wBeginMonth,
82 "wBeginMonth: Found %d but expected %d\n",
83 found_state.wBeginMonth, expected_state.wBeginMonth);
85 ok(found_state.wBeginDay == expected_state.wBeginDay,
86 "wBeginDay: Found %d but expected %d\n",
87 found_state.wBeginDay, expected_state.wBeginDay);
89 ok(found_state.wEndYear == expected_state.wEndYear,
90 "wEndYear: Found %d but expected %d\n",
91 found_state.wEndYear, expected_state.wEndYear);
93 ok(found_state.wEndMonth == expected_state.wEndMonth,
94 "wEndMonth: Found %d but expected %d\n",
95 found_state.wEndMonth, expected_state.wEndMonth);
97 ok(found_state.wEndDay == expected_state.wEndDay,
98 "wEndDay: Found %d but expected %d\n",
99 found_state.wEndDay, expected_state.wEndDay);
101 ok(found_state.wStartHour == expected_state.wStartHour,
102 "wStartHour: Found %d but expected %d\n",
103 found_state.wStartHour, expected_state.wStartHour);
105 ok(found_state.wStartMinute == expected_state.wStartMinute,
106 "wStartMinute: Found %d but expected %d\n",
107 found_state.wStartMinute, expected_state.wStartMinute);
109 ok(found_state.MinutesDuration == expected_state.MinutesDuration,
110 "MinutesDuration: Found %d but expected %d\n",
111 found_state.MinutesDuration, expected_state.MinutesDuration);
113 ok(found_state.MinutesInterval == expected_state.MinutesInterval,
114 "MinutesInterval: Found %d but expected %d\n",
115 found_state.MinutesInterval, expected_state.MinutesInterval);
117 ok(found_state.rgFlags == expected_state.rgFlags,
118 "rgFlags: Found %d but expected %d\n",
119 found_state.rgFlags, expected_state.rgFlags);
121 ok(found_state.TriggerType == expected_state.TriggerType,
122 "TriggerType: Found %d but expected %d\n",
123 found_state.TriggerType, expected_state.TriggerType);
125 ok(found_state.Type.Daily.DaysInterval == expected_state.Type.Daily.DaysInterval,
126 "Type.Daily.DaysInterval: Found %d but expected %d\n",
127 found_state.Type.Daily.DaysInterval, expected_state.Type.Daily.DaysInterval);
129 ok(found_state.Reserved2 == expected_state.Reserved2,
130 "Reserved2: Found %d but expected %d\n",
131 found_state.Reserved2, expected_state.Reserved2);
133 ok(found_state.wRandomMinutesInterval == expected_state.wRandomMinutesInterval,
134 "wRandomMinutesInterval: Found %d but expected %d\n",
135 found_state.wRandomMinutesInterval, expected_state.wRandomMinutesInterval);
144 TASK_TRIGGER trigger_state;
145 TASK_TRIGGER empty_trigger_state = {
146 sizeof(trigger_state), 0,
150 TASK_TRIGGER_FLAG_DISABLED, TASK_TIME_TRIGGER_DAILY, {{1}},
153 TASK_TRIGGER normal_trigger_state = {
154 sizeof(trigger_state), 0,
159 TASK_TRIGGER_FLAG_DISABLED, TASK_TIME_TRIGGER_DAILY, {{1}},
165 ok(
setup,
"Failed to setup test_task\n");
168 skip(
"Failed to create task. Skipping tests.\n");
174 empty_trigger_state.wStartHour =
time.wHour;
175 empty_trigger_state.wStartMinute =
time.wMinute;
176 empty_trigger_state.wBeginYear =
time.wYear;
177 empty_trigger_state.wBeginMonth =
time.wMonth;
178 empty_trigger_state.wBeginDay =
time.wDay;
181 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
182 trigger_state.cbTriggerSize =
sizeof(trigger_state);
190 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
191 trigger_state.cbTriggerSize =
sizeof(trigger_state);
199 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
200 trigger_state.cbTriggerSize =
sizeof(trigger_state);
211 normal_trigger_state.cbTriggerSize =
sizeof(trigger_state) - 1;
214 normal_trigger_state.cbTriggerSize =
sizeof(trigger_state) + 1;
217 normal_trigger_state.cbTriggerSize =
sizeof(trigger_state);
220 normal_trigger_state.Reserved1 = 80;
221 normal_trigger_state.Reserved2 = 80;
224 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
225 trigger_state.cbTriggerSize =
sizeof(trigger_state);
228 ok(trigger_state.Reserved1 == 0 && trigger_state.Reserved2 == 0,
229 "Reserved fields should be set to zero\n");
230 normal_trigger_state.Reserved1 = 0;
231 normal_trigger_state.Reserved2 = 0;
234 normal_trigger_state.wBeginMonth = 0;
237 normal_trigger_state.wBeginMonth = 13;
240 normal_trigger_state.wBeginMonth = 1;
243 normal_trigger_state.wBeginDay = 0;
246 normal_trigger_state.wBeginDay = 32;
249 normal_trigger_state.wBeginMonth = 2;
250 normal_trigger_state.wBeginDay = 30;
253 normal_trigger_state.wBeginMonth = 1;
254 normal_trigger_state.wBeginDay = 1;
257 normal_trigger_state.wEndYear = 0;
258 normal_trigger_state.wEndMonth = 200;
259 normal_trigger_state.wEndDay = 200;
262 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
263 trigger_state.cbTriggerSize =
sizeof(trigger_state);
266 ok(trigger_state.wEndYear == 0,
"End year should be 0: %d\n",
267 trigger_state.wEndYear);
268 ok(trigger_state.wEndMonth == 200,
"End month should be 200: %d\n",
269 trigger_state.wEndMonth);
270 ok(trigger_state.wEndDay == 200,
"End day should be 200: %d\n",
271 trigger_state.wEndDay);
272 normal_trigger_state.rgFlags =
273 TASK_TRIGGER_FLAG_DISABLED | TASK_TRIGGER_FLAG_HAS_END_DATE;
276 normal_trigger_state.rgFlags = TASK_TRIGGER_FLAG_DISABLED;
277 normal_trigger_state.wEndYear = 2980;
278 normal_trigger_state.wEndMonth = 1;
279 normal_trigger_state.wEndDay = 1;
282 normal_trigger_state.wStartHour = 24;
285 normal_trigger_state.wStartHour = 60;
288 normal_trigger_state.wStartHour = 3;
291 normal_trigger_state.MinutesDuration = 5;
292 normal_trigger_state.MinutesInterval = 5;
295 normal_trigger_state.MinutesDuration = 5;
296 normal_trigger_state.MinutesInterval = 6;
299 normal_trigger_state.MinutesDuration = 0;
300 normal_trigger_state.MinutesInterval = 6;
303 normal_trigger_state.MinutesDuration = 5;
304 normal_trigger_state.MinutesInterval = 0;
307 normal_trigger_state.MinutesDuration = 0;
308 normal_trigger_state.MinutesInterval = 0;
311 normal_trigger_state.wEndYear = 1979;
314 normal_trigger_state.rgFlags =
315 TASK_TRIGGER_FLAG_DISABLED | TASK_TRIGGER_FLAG_HAS_END_DATE;
318 normal_trigger_state.rgFlags = TASK_TRIGGER_FLAG_DISABLED;
319 normal_trigger_state.wEndYear = 2980;
320 normal_trigger_state.wEndMonth = 1;
321 normal_trigger_state.wEndDay = 1;
325 normal_trigger_state.TriggerType = TASK_TIME_TRIGGER_ONCE;
326 normal_trigger_state.Type.Weekly.WeeksInterval = 2;
327 normal_trigger_state.Type.Weekly.rgfDaysOfTheWeek = (TASK_MONDAY | TASK_TUESDAY);
330 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
331 trigger_state.cbTriggerSize =
sizeof(trigger_state);
334 ok(trigger_state.Type.Weekly.WeeksInterval == 0xcfcf,
335 "Expected WeeksInterval set remain untouched: %d\n",
336 trigger_state.Type.Weekly.WeeksInterval);
337 ok(trigger_state.Type.Weekly.rgfDaysOfTheWeek == 0xcfcf,
338 "Expected WeeksInterval set remain untouched: %d\n",
339 trigger_state.Type.Weekly.rgfDaysOfTheWeek);
340 normal_trigger_state.TriggerType = TASK_TIME_TRIGGER_DAILY;
341 normal_trigger_state.Type.Daily.DaysInterval = 1;
346 normal_trigger_state.wRandomMinutesInterval = 5;
349 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
350 trigger_state.cbTriggerSize =
sizeof(trigger_state);
353 ok(trigger_state.wRandomMinutesInterval == 0,
354 "wRandomMinutesInterval should be set to zero\n");
355 normal_trigger_state.wRandomMinutesInterval = 0;
361 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
362 trigger_state.cbTriggerSize =
sizeof(trigger_state) - 1;
367 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
368 trigger_state.cbTriggerSize = 0;
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
static void cleanup_trigger(void)
static ITaskScheduler * test_task_scheduler
static BOOL setup_trigger(void)
static BOOL compare_trigger_state(TASK_TRIGGER found_state, TASK_TRIGGER expected_state)
static WORD trigger_index
static void test_SetTrigger_GetTrigger(void)
static ITaskTrigger * test_trigger