| 168 | TEST(CommandLineTests, QPCTimeInMilliSeconds) { QpcTimeTest<double>(false); } |
| 169 | |
| 170 | void InputTest(uint32_t v) |
| 171 | { |
| 172 | std::wstring csvPath(outDir_ + L"input.csv"); |
| 173 | |
| 174 | // TODO: This test requires a target application to be presenting, and the |
| 175 | // user to provide input (move the mouse at minimum) during the capture. |
| 176 | // Otherwise the test will fail. Is there a better way than just hoping |
| 177 | // this happens and failing if not? |
| 178 | |
| 179 | PresentMon pm; |
| 180 | pm.Add(L"--stop_existing_session --terminate_after_timed --timed 3"); |
| 181 | if (v == 1) { |
| 182 | pm.Add(L"--v1_metrics"); |
| 183 | } |
| 184 | pm.AddCsvPath(csvPath); |
| 185 | |
| 186 | pm.PMSTART(); |
| 187 | pm.PMEXITED(5000, 0); |
| 188 | if (::testing::Test::HasFailure()) { |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | PresentMonCsv csv; |
| 193 | if (!csv.CSVOPEN(csvPath)) { |
| 194 | printf(" PresentMon didn't create a CSV file, likely because there were no presents to capture.\n" |
| 195 | " Re-run the test with a graphics application running.\n"); |
| 196 | return; |
| 197 | } |
| 198 | |
| 199 | char const* inputHeader = v == 1 ? "msSinceInput" : "AllInputToPhotonLatency"; |
| 200 | |
| 201 | auto idxInputHeader = csv.GetColumnIndex(inputHeader); |
| 202 | if (idxInputHeader == SIZE_MAX) { |
| 203 | FAIL() << " Output missing required column: " << inputHeader; |
| 204 | } |
| 205 | |
| 206 | uint32_t nonZeroInputRowCount = 0; |
| 207 | while (!::testing::Test::HasFailure() && csv.ReadRow()) { |
| 208 | auto inputValue = strtod(csv.cols_[idxInputHeader], nullptr); |
| 209 | if (inputValue != 0) { |
| 210 | nonZeroInputRowCount += 1; |
| 211 | } |
| 212 | } |
| 213 | csv.Close(); |
| 214 | |
| 215 | ASSERT_GT(csv.line_, 1u) |
| 216 | << " PresentMon didn't capture any presents during the test.\n" |
| 217 | " Re-run the test with a graphics application running."; |
| 218 | |
| 219 | EXPECT_GT(nonZeroInputRowCount, 0u) |
| 220 | << " PresentMon didn't capture any inputs during the test.\n" |
| 221 | " Re-run the test and make sure to interact with the kb or mouse."; |
| 222 | |
| 223 | if (::testing::Test::HasFailure()) { |
| 224 | printf("%ls\n", csvPath.c_str()); |
| 225 | } |
| 226 | } |
| 227 |
no test coverage detected