forked from microsoft/cppwinrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvelocity.cpp
More file actions
44 lines (33 loc) · 1.29 KB
/
velocity.cpp
File metadata and controls
44 lines (33 loc) · 1.29 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
43
44
#include "pch.h"
#include "winrt/test_component.Velocity.h"
using namespace winrt;
using namespace test_component::Velocity;
TEST_CASE("velocity")
{
// This interface is always disabled but shows up in the type system
// if it is present in the winmd.
IInterface1 a;
REQUIRE(a == nullptr);
// This interface is always enabled and is naturally available in
// the projection.
IInterface2 b;
REQUIRE(b == nullptr);
// Class1 is always disabled and thus will not activate.
REQUIRE_THROWS_AS(Class1(), hresult_class_not_registered);
// Class2 is always enabled so should activate just fine.
Class2 c;
c.Class2_Method();
// Class3 is always disabled and thus will not activate.
REQUIRE_THROWS_AS(Class3(), hresult_class_not_registered);
// Class4 is not feature-controlled but uses feature interfaces.
Class4 d;
d.Class4_Method();
// The single argument constructor is always disabled.
REQUIRE_THROWS_AS(Class4(1), hresult_class_not_registered);
// The Class4_Static1 static is always disabled.
REQUIRE_THROWS_AS(Class4::Class4_Static1(), hresult_class_not_registered);
// The two argument constructor is always enabled.
Class4 e(1, 2);
// The Class4_Static2 static is always enabled.
Class4::Class4_Static2();
}