ReactOS  0.4.14-dev-614-gbfd8a84
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 84 of file CComQIPtr.cpp.

Function Documentation

◆ START_TEST()

START_TEST ( CComQIPtr  )

Definition at line 87 of file CComQIPtr.cpp.

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

Variable Documentation

◆ g_QI

LONG g_QI = 0
static

Definition at line 18 of file CComQIPtr.cpp.

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