taskschd: Added IDailyTrigger::DaysInterval property implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-10-19 14:04:32 +02:00 committed by Alexandre Julliard
parent 18427a0ce0
commit 82a590403f
2 changed files with 39 additions and 4 deletions

View File

@ -38,6 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(taskschd);
typedef struct { typedef struct {
IDailyTrigger IDailyTrigger_iface; IDailyTrigger IDailyTrigger_iface;
LONG ref; LONG ref;
short interval;
} DailyTrigger; } DailyTrigger;
static inline DailyTrigger *impl_from_IDailyTrigger(IDailyTrigger *iface) static inline DailyTrigger *impl_from_IDailyTrigger(IDailyTrigger *iface)
@ -217,15 +218,24 @@ static HRESULT WINAPI DailyTrigger_put_Enabled(IDailyTrigger *iface, VARIANT_BOO
static HRESULT WINAPI DailyTrigger_get_DaysInterval(IDailyTrigger *iface, short *days) static HRESULT WINAPI DailyTrigger_get_DaysInterval(IDailyTrigger *iface, short *days)
{ {
DailyTrigger *This = impl_from_IDailyTrigger(iface); DailyTrigger *This = impl_from_IDailyTrigger(iface);
FIXME("(%p)->(%p)\n", This, days);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, days);
*days = This->interval;
return S_OK;
} }
static HRESULT WINAPI DailyTrigger_put_DaysInterval(IDailyTrigger *iface, short days) static HRESULT WINAPI DailyTrigger_put_DaysInterval(IDailyTrigger *iface, short days)
{ {
DailyTrigger *This = impl_from_IDailyTrigger(iface); DailyTrigger *This = impl_from_IDailyTrigger(iface);
FIXME("(%p)->(%d)\n", This, days);
return E_NOTIMPL; TRACE("(%p)->(%d)\n", This, days);
if(days <= 0)
return E_INVALIDARG;
This->interval = days;
return S_OK;
} }
static HRESULT WINAPI DailyTrigger_get_RandomDelay(IDailyTrigger *iface, BSTR *pRandomDelay) static HRESULT WINAPI DailyTrigger_get_RandomDelay(IDailyTrigger *iface, BSTR *pRandomDelay)
@ -279,6 +289,7 @@ static HRESULT DailyTrigger_create(ITrigger **trigger)
daily_trigger->IDailyTrigger_iface.lpVtbl = &DailyTrigger_vtbl; daily_trigger->IDailyTrigger_iface.lpVtbl = &DailyTrigger_vtbl;
daily_trigger->ref = 1; daily_trigger->ref = 1;
daily_trigger->interval = 1;
*trigger = (ITrigger*)&daily_trigger->IDailyTrigger_iface; *trigger = (ITrigger*)&daily_trigger->IDailyTrigger_iface;
return S_OK; return S_OK;

View File

@ -1174,11 +1174,35 @@ todo_wine
static void test_daily_trigger(ITrigger *trigger) static void test_daily_trigger(ITrigger *trigger)
{ {
IDailyTrigger *daily_trigger; IDailyTrigger *daily_trigger;
short interval;
HRESULT hr; HRESULT hr;
hr = ITrigger_QueryInterface(trigger, &IID_IDailyTrigger, (void**)&daily_trigger); hr = ITrigger_QueryInterface(trigger, &IID_IDailyTrigger, (void**)&daily_trigger);
ok(hr == S_OK, "Could not get IDailyTrigger iface: %08x\n", hr); ok(hr == S_OK, "Could not get IDailyTrigger iface: %08x\n", hr);
interval = -1;
hr = IDailyTrigger_get_DaysInterval(daily_trigger, &interval);
ok(hr == S_OK, "get_DaysInterval failed: %08x\n", hr);
ok(interval == 1, "interval = %d\n", interval);
hr = IDailyTrigger_put_DaysInterval(daily_trigger, -2);
ok(hr == E_INVALIDARG, "put_DaysInterval failed: %08x\n", hr);
hr = IDailyTrigger_put_DaysInterval(daily_trigger, 0);
ok(hr == E_INVALIDARG, "put_DaysInterval failed: %08x\n", hr);
interval = -1;
hr = IDailyTrigger_get_DaysInterval(daily_trigger, &interval);
ok(hr == S_OK, "get_DaysInterval failed: %08x\n", hr);
ok(interval == 1, "interval = %d\n", interval);
hr = IDailyTrigger_put_DaysInterval(daily_trigger, 2);
ok(hr == S_OK, "put_DaysInterval failed: %08x\n", hr);
interval = -1;
hr = IDailyTrigger_get_DaysInterval(daily_trigger, &interval);
ok(hr == S_OK, "get_DaysInterval failed: %08x\n", hr);
ok(interval == 2, "interval = %d\n", interval);
IDailyTrigger_Release(daily_trigger); IDailyTrigger_Release(daily_trigger);
} }