141{
144 TASK_TRIGGER trigger_state;
145 TASK_TRIGGER empty_trigger_state = {
146 sizeof(trigger_state), 0,
147 0, 0, 0,
148 0, 0, 0,
149 0, 0, 0, 0,
150 TASK_TRIGGER_FLAG_DISABLED, TASK_TIME_TRIGGER_DAILY, {{1}},
151 0, 0
152 };
153 TASK_TRIGGER normal_trigger_state = {
154 sizeof(trigger_state), 0,
155 1980, 1, 1,
156 2980, 2, 2,
157 3, 3,
158 0, 0,
159 TASK_TRIGGER_FLAG_DISABLED, TASK_TIME_TRIGGER_DAILY, {{1}},
160 0, 0
161 };
163
165 ok(
setup,
"Failed to setup test_task\n");
167 {
168 skip(
"Failed to create task. Skipping tests.\n");
169 return;
170 }
171
172
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;
179
180
181 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
182 trigger_state.cbTriggerSize = sizeof(trigger_state);
186
187
190 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
191 trigger_state.cbTriggerSize = sizeof(trigger_state);
195
196
199 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
200 trigger_state.cbTriggerSize = sizeof(trigger_state);
204
205
206
207
208
209
210
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);
218
219
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;
232
233
234 normal_trigger_state.wBeginMonth = 0;
237 normal_trigger_state.wBeginMonth = 13;
240 normal_trigger_state.wBeginMonth = 1;
241
242
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;
255
256
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;
280
281
282 normal_trigger_state.wStartHour = 24;
285 normal_trigger_state.wStartHour = 60;
288 normal_trigger_state.wStartHour = 3;
289
290
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;
309
310
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;
322
323
324
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;
344
345
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;
356
357
358
361 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
362 trigger_state.cbTriggerSize = sizeof(trigger_state) - 1;
366 "Invalid state\n");
367 memset(&trigger_state, 0xcf,
sizeof(trigger_state));
368 trigger_state.cbTriggerSize = 0;
372 "Invalid state\n");
373
374
376 return;
377}
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
static void cleanup_trigger(void)
static BOOL setup_trigger(void)
static BOOL compare_trigger_state(TASK_TRIGGER found_state, TASK_TRIGGER expected_state)