| 178 | } |
| 179 | |
| 180 | inline void comparePatches(const IPatch& patch, const IPatch& expected, const std::string& infoText) |
| 181 | { |
| 182 | EXPECT_EQ(patch.getWidth(), expected.getWidth()) << infoText << ": Width mismatch"; |
| 183 | EXPECT_EQ(patch.getHeight(), expected.getHeight()) << infoText << ": Height mismatch"; |
| 184 | |
| 185 | // Check the whole control point matrix |
| 186 | for (auto row = 0; row < patch.getHeight(); ++row) |
| 187 | { |
| 188 | for (auto col = 0; col < patch.getWidth(); ++col) |
| 189 | { |
| 190 | const auto& expectedCtrl = expected.ctrlAt(row, col); |
| 191 | const auto& ctrl = patch.ctrlAt(row, col); |
| 192 | |
| 193 | EXPECT_TRUE(math::isNear(ctrl.vertex, expectedCtrl.vertex, 0.01)) << infoText << ": Vertex mismatch at " << row << "," << col; |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | TEST_F(PatchTest, CapPatch) |
| 199 | { |