ReactOS 0.4.15-dev-8235-gcd88a97
CComObject.cpp File Reference
#include <atlbase.h>
#include <atlcom.h>
#include "atltest.h"
Include dependency graph for CComObject.cpp:

Go to the source code of this file.

Classes

class  CTestObject
 
class  CDumExe
 

Functions

 START_TEST (CComObject)
 

Variables

static LONG g_CTOR = 0
 
static LONG g_DTOR = 0
 
static LONG g_BLIND = 0
 
CDumExe dum
 

Function Documentation

◆ START_TEST()

START_TEST ( CComObject  )

Definition at line 74 of file CComObject.cpp.

75{
76 g_CTOR = g_DTOR = g_BLIND = 0;
77
78 CComObject<CTestObject>* pTest;
79 HRESULT hr = CComObject<CTestObject>::CreateInstance(&pTest);
80
81 ok(hr == S_OK, "Expected S_OK, got 0x%lx\n", hr);
82
83 ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
84 ok(g_DTOR == 0, "Expected 0, got %lu\n", g_DTOR);
85 ok(g_BLIND == 0, "Expected 0, got %lu\n", g_BLIND);
86
87 if (hr == S_OK)
88 {
89 ULONG ref = pTest->AddRef();
90 ok(ref == 1, "Expected 1, got %lu\n", ref);
91
92 {
93 CComPtr<IUnknown> ppv;
94 hr = pTest->QueryInterface(IID_IUnknown, (void **) &ppv);
95 ok(hr == S_OK, "Expected S_OK, got 0x%lx\n", hr);
96 ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
97 ok(g_DTOR == 0, "Expected 0, got %lu\n", g_DTOR);
98 ok(g_BLIND == 0, "Expected 0, got %lu\n", g_BLIND);
99
100 CComPtr<IPersist> ppersist;
101 hr = pTest->QueryInterface(IID_IPersist, (void **)&ppersist);
102 ok(hr == S_OK, "Expected S_OK, got 0x%lx\n", hr);
103 ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
104 ok(g_DTOR == 0, "Expected 0, got %lu\n", g_DTOR);
105 ok(g_BLIND == 0, "Expected 0, got %lu\n", g_BLIND);
106
107 }
108
109 {
110 CComPtr<IStdMarshalInfo> pstd;
111 hr = pTest->QueryInterface(IID_IStdMarshalInfo, (void **)&pstd);
112 ok(hr == S_OK, "Expected S_OK, got 0x%lx\n", hr);
113 ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
114 ok(g_DTOR == 0, "Expected 0, got %lu\n", g_DTOR);
115 ok(g_BLIND == 1, "Expected 1, got %lu\n", g_BLIND);
116 }
117
118 ref = pTest->Release();
119 ok(ref == 0, "Expected 0, got %lu\n", ref);
120 ok(g_CTOR == 1, "Expected 1, got %lu\n", g_CTOR);
121 ok(g_DTOR == 1, "Expected 1, got %lu\n", g_DTOR);
122 ok(g_BLIND == 1, "Expected 1, got %lu\n", g_BLIND);
123 }
124}
static LONG g_CTOR
Definition: CComObject.cpp:19
static LONG g_DTOR
Definition: CComObject.cpp:20
static LONG g_BLIND
Definition: CComObject.cpp:21
#define ok(value,...)
Definition: atltest.h:57
const GUID IID_IUnknown
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define S_OK
Definition: intsafe.h:52
const GUID IID_IPersist
Definition: proxy.cpp:14
HRESULT hr
Definition: shlfolder.c:183
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

Variable Documentation

◆ dum

CDumExe dum

Definition at line 71 of file CComObject.cpp.

Referenced by RECTL_Intersect(), SdbBeginWriteListTag(), and START_TEST().

◆ g_BLIND

LONG g_BLIND = 0
static

Definition at line 21 of file CComObject.cpp.

Referenced by CTestObject::FuncBlind(), and START_TEST().

◆ g_CTOR

LONG g_CTOR = 0
static

Definition at line 19 of file CComObject.cpp.

Referenced by CTestObject::CTestObject(), and START_TEST().

◆ g_DTOR

LONG g_DTOR = 0
static

Definition at line 20 of file CComObject.cpp.

Referenced by START_TEST(), and CTestObject::~CTestObject().