2 * Unit tests for Timeline
4 * Copyright (C) 2016 Alex Henrie
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/test.h"
27 static void test_timeline(void)
30 IAMTimeline
*timeline
= NULL
;
31 IAMTimeline
*timeline2
= (IAMTimeline
*)0xdeadbeef;
32 IAMTimelineObj
*obj
= (IAMTimelineObj
*)0xdeadbeef;
33 IAMTimelineObj obj_iface
;
34 TIMELINE_MAJOR_TYPE type
;
36 hr
= CoCreateInstance(&CLSID_AMTimeline
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IAMTimeline
, (void **)&timeline
);
37 ok(hr
== S_OK
|| broken(hr
== REGDB_E_CLASSNOTREG
), "CoCreateInstance failed: %08x\n", hr
);
38 if (!timeline
) return;
40 hr
= IAMTimeline_QueryInterface(timeline
, &IID_IAMTimelineObj
, NULL
);
41 ok(hr
== E_POINTER
, "Expected E_POINTER got %08x\n", hr
);
43 hr
= IAMTimeline_QueryInterface(timeline
, &IID_IAMTimelineObj
, (void **)&obj
);
44 ok(hr
== E_NOINTERFACE
, "Expected E_NOINTERFACE got %08x\n", hr
);
45 ok(!obj
, "Expected NULL got %p\n", obj
);
47 hr
= IAMTimeline_CreateEmptyNode(timeline
, NULL
, 0);
48 ok(hr
== E_POINTER
, "Expected E_POINTER got %08x\n", hr
);
50 hr
= IAMTimeline_CreateEmptyNode(timeline
, NULL
, TIMELINE_MAJOR_TYPE_COMPOSITE
);
51 ok(hr
== E_POINTER
, "Expected E_POINTER got %08x\n", hr
);
53 for (type
= 0; type
< 256; type
++)
56 hr
= IAMTimeline_CreateEmptyNode(timeline
, &obj
, type
);
59 case TIMELINE_MAJOR_TYPE_COMPOSITE
:
60 case TIMELINE_MAJOR_TYPE_TRACK
:
61 case TIMELINE_MAJOR_TYPE_SOURCE
:
62 case TIMELINE_MAJOR_TYPE_TRANSITION
:
63 case TIMELINE_MAJOR_TYPE_EFFECT
:
64 case TIMELINE_MAJOR_TYPE_GROUP
:
65 ok(hr
== S_OK
, "CreateEmptyNode failed: %08x\n", hr
);
66 if (obj
!= &obj_iface
) IAMTimelineObj_Release(obj
);
69 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG got %08x\n", hr
);
70 ok(obj
== &obj_iface
, "Expected %p got %p\n", &obj_iface
, obj
);
75 hr
= IAMTimeline_CreateEmptyNode(timeline
, &obj
, TIMELINE_MAJOR_TYPE_COMPOSITE
);
76 ok(hr
== S_OK
, "CreateEmptyNode failed: %08x\n", hr
);
79 hr
= IAMTimelineObj_QueryInterface(obj
, &IID_IAMTimeline
, NULL
);
80 ok(hr
== E_POINTER
, "Expected E_POINTER got %08x\n", hr
);
82 hr
= IAMTimelineObj_QueryInterface(obj
, &IID_IAMTimeline
, (void **)&timeline2
);
83 ok(hr
== E_NOINTERFACE
, "Expected E_NOINTERFACE got %08x\n", hr
);
84 ok(!timeline2
, "Expected NULL got %p\n", timeline2
);
86 hr
= IAMTimelineObj_GetTimelineType(obj
, NULL
);
87 ok(hr
== E_POINTER
, "Expected E_POINTER got %08x\n", hr
);
89 hr
= IAMTimelineObj_GetTimelineType(obj
, &type
);
90 ok(hr
== S_OK
, "GetTimelineType failed: %08x\n", hr
);
91 ok(type
== TIMELINE_MAJOR_TYPE_COMPOSITE
, "Expected TIMELINE_MAJOR_TYPE_COMPOSITE got %d\n", type
);
93 for (type
= 0; type
< 256; type
++)
95 hr
= IAMTimelineObj_SetTimelineType(obj
, type
);
96 if (type
== TIMELINE_MAJOR_TYPE_COMPOSITE
)
97 ok(hr
== S_OK
, "SetTimelineType failed: %08x\n", hr
);
99 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG got %08x\n", hr
);
102 hr
= IAMTimelineObj_GetTimelineNoRef(obj
, NULL
);
103 ok(hr
== E_POINTER
, "Expected E_POINTER got %08x\n", hr
);
105 timeline2
= (IAMTimeline
*)0xdeadbeef;
106 hr
= IAMTimelineObj_GetTimelineNoRef(obj
, &timeline2
);
107 ok(hr
== E_NOINTERFACE
, "Expected E_NOINTERFACE got %08x\n", hr
);
108 ok(!timeline2
, "Expected NULL got %p\n", timeline2
);