ReactOS 0.4.15-dev-7924-g5949c20
CComQIPtr.cpp File Reference
#include <atlbase.h>
#include <atlcom.h>
#include "atltest.h"
Include dependency graph for CComQIPtr.cpp:

Go to the source code of this file.

Classes

class  CQITestObject
 

Macros

#define DECLARE_QIPTR(type)   CComQIPtr<type>
 

Functions

 START_TEST (CComQIPtr)
 

Variables

static LONG g_QI = 0
 

Macro Definition Documentation

◆ DECLARE_QIPTR

#define DECLARE_QIPTR (   type)    CComQIPtr<type>

Definition at line 86 of file CComQIPtr.cpp.

Function Documentation

◆ START_TEST()

START_TEST ( CComQIPtr  )

Definition at line 89 of file CComQIPtr.cpp.

90{
91 CQITestObject testObject;
92 IUnknown* unk = static_cast<IPersist*>(&testObject);
93 ok_long(testObject.m_dwRef, 1);
94 ok_long(g_QI, 0);
95
96 {
97 DECLARE_QIPTR(IPersist) ppPersist(unk);
98 ok_long(testObject.m_dwRef, 2);
99 ok_long(g_QI, 1);
100
101 DECLARE_QIPTR(IStdMarshalInfo) ppMarshal(ppPersist);
102 ok_long(testObject.m_dwRef, 3);
103 ok_long(g_QI, 2);
104 }
105 ok_long(testObject.m_dwRef, 1);
106 {
108 ok_long(testObject.m_dwRef, 1);
109 ok_long(g_QI, 2);
110
111 ppMarshal = unk;
112 ok_long(testObject.m_dwRef, 2);
113 ok_long(g_QI, 3);
114
115 ppMarshal = static_cast<IUnknown*>(NULL);
116 ok_long(testObject.m_dwRef, 1);
117 ok_long(g_QI, 3);
118
119 CComPtr<IUnknown> spUnk(unk);
120 ok_long(testObject.m_dwRef, 2);
121 ok_long(g_QI, 3);
122
123 ppMarshal = spUnk;
124 ok_long(testObject.m_dwRef, 3);
125 ok_long(g_QI, 4);
126
127 spUnk.Release();
128 ok_long(testObject.m_dwRef, 2);
129 ok_long(g_QI, 4);
130
131 spUnk = ppMarshal;
132 ok_long(testObject.m_dwRef, 3);
133#ifdef __REACTOS__
134 // CORE-12710
135 todo_if(1)
136#endif
137 ok_long(g_QI, 5);
138 }
139}
#define DECLARE_QIPTR(type)
Definition: CComQIPtr.cpp:86
static LONG g_QI
Definition: CComQIPtr.cpp:18
#define ok_long(expression, result)
Definition: atltest.h:133
#define NULL
Definition: types.h:112
#define todo_if(is_todo)
Definition: test.h:163

Variable Documentation

◆ g_QI

LONG g_QI = 0
static

Definition at line 18 of file CComQIPtr.cpp.

Referenced by CQITestObject::QueryInterface(), and START_TEST().