forked from microsoft/cppwinrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComposition.cpp
More file actions
42 lines (31 loc) · 1.39 KB
/
Copy pathComposition.cpp
File metadata and controls
42 lines (31 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "pch.h"
#include "winrt/test_component_fast.Composition.h"
using namespace winrt::test_component_fast::Composition;
// All, yes all, of the QIs in the test below are avoided by the fastabi.
// That's 8 calls to QueryInterface and 8 calls to Release.
TEST_CASE("Composition")
{
// IActivationFactory::ActivateInstance is called for the default constructor.
// Under the slowabi, the ActivateInstance method returns IInspectable so each
// caller must QI for the default interface.
Compositor compositor;
SpriteVisual v1 = compositor.CreateSpriteVisual();
SpriteVisual v2 = compositor.CreateSpriteVisual();
// Under the slowabi, this needs a QI for ICompositionObject.
assert(v1.Compositor() == compositor);
// Under the slowabi, this needs a QI for ICompositionObject2.
v1.StartAnimationGroup();
// Under the slowabi, this needs a QI for IVisual for each call.
v1.Offset(123);
assert(v1.Offset() == 123);
// Under the slowabi, this needs a QI for IVisual2 to call ParentForTransform
// *and* the v2 parameter needs a QI for IVisual.
v1.ParentForTransform(v2);
// Since Brush is on the default interface of SpriteVisual there's no QI here
// for both slowabi and fastabi.
v1.Brush();
// Under the slowabi, this needs a QI for ISpriteVisual2.
v1.Shadow();
// Non exclusive interface requires QI as usual.
v1.Close();
}