MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / TEST_CLASS

Function TEST_CLASS

IntelPresentMon/UnitTests/MetricsCore.cpp:172–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170 // ============================================================================
171
172 TEST_CLASS(SwapChainCoreStateTests)
173 {
174 public:
175 // Simple mock type for testing - just needs to be storable
176 struct MockPresent {
177 uint64_t presentStartTime = 0;
178 };
179
180 TEST_METHOD(DefaultConstruction_InitializesTimestampsToZero)
181 {
182 SwapChainCoreState swapChain;
183
184 Assert::AreEqual(0ull, swapChain.lastSimStartTime);
185 Assert::AreEqual(0ull, swapChain.lastDisplayedSimStartTime);
186 Assert::AreEqual(0ull, swapChain.lastDisplayedScreenTime);
187 Assert::AreEqual(0ull, swapChain.firstAppSimStartTime);
188 }
189
190 TEST_METHOD(DefaultConstruction_InitializesOptionalPresentToEmpty)
191 {
192 SwapChainCoreState swapChain;
193
194 Assert::IsFalse(swapChain.lastPresent.has_value());
195 Assert::IsFalse(swapChain.lastAppPresent.has_value());
196 }
197
198 TEST_METHOD(LastPresent_CanBeAssigned)
199 {
200 SwapChainCoreState swapChain;
201 FrameData p1{};
202 p1.presentStartTime = 12345;
203 swapChain.lastPresent = p1;
204
205 Assert::IsTrue(swapChain.lastPresent.has_value());
206 Assert::AreEqual(12345ull, swapChain.lastPresent.value().presentStartTime);
207 }
208
209 TEST_METHOD(DroppedInputTracking_InitializesToZero)
210 {
211 SwapChainCoreState swapChain;
212
213 Assert::AreEqual(0ull, swapChain.lastReceivedNotDisplayedAllInputTime);
214 Assert::AreEqual(0ull, swapChain.lastReceivedNotDisplayedMouseClickTime);
215 Assert::AreEqual(0ull, swapChain.lastReceivedNotDisplayedAppProviderInputTime);
216 }
217
218 TEST_METHOD(DroppedInputTracking_CanBeUpdated)
219 {
220 SwapChainCoreState swapChain;
221
222 swapChain.lastReceivedNotDisplayedAllInputTime = 1000;
223 swapChain.lastReceivedNotDisplayedMouseClickTime = 2000;
224 swapChain.lastReceivedNotDisplayedAppProviderInputTime = 3000;
225
226 Assert::AreEqual(1000ull, swapChain.lastReceivedNotDisplayedAllInputTime);
227 Assert::AreEqual(2000ull, swapChain.lastReceivedNotDisplayedMouseClickTime);
228 Assert::AreEqual(3000ull, swapChain.lastReceivedNotDisplayedAppProviderInputTime);
229 }

Callers

nothing calls this directly

Calls 15

CalculateCPUStartFunction · 0.85
CalculateAnimationTimeFunction · 0.85
MakeFrameFunction · 0.85
ComputeMetricsForPresentFunction · 0.85
HasMetricValueFunction · 0.85
EnqueueMethod · 0.80
GetLastPresentQpcMethod · 0.80
UpdateAfterPresentMethod · 0.80
DurationMilliSecondsMethod · 0.80
ClearMethod · 0.45

Tested by

no test coverage detected