| 178 | } |
| 179 | |
| 180 | void performPatchFlipTest(int axis) |
| 181 | { |
| 182 | auto worldspawn = GlobalMapModule().findOrInsertWorldspawn(); |
| 183 | auto patchNode = algorithm::createPatchFromBounds(worldspawn, AABB(Vector3(4, 50, 60), Vector3(64, 128, 256)), "textures/numbers/1"); |
| 184 | |
| 185 | auto patch = Node_getIPatch(patchNode); |
| 186 | patch->scaleTextureNaturally(); |
| 187 | patch->controlPointsChanged(); |
| 188 | |
| 189 | Node_setSelected(patchNode, true); |
| 190 | |
| 191 | // Get the texture space bounds of this patch |
| 192 | auto patchBounds = algorithm::getTextureSpaceBounds(*patch); |
| 193 | auto bounds = patchBounds; |
| 194 | bounds.extents *= 1.2f; |
| 195 | |
| 196 | std::vector<Vector2> oldTexCoords; |
| 197 | algorithm::foreachPatchVertex(*patch, [&](const PatchControl& ctrl) { oldTexCoords.push_back(ctrl.texcoord); }); |
| 198 | |
| 199 | auto cmd = axis == 0 ? "FlipTextureX" : "FlipTextureY"; |
| 200 | GlobalCommandSystem().executeCommand(cmd); |
| 201 | |
| 202 | // Every changed vertex should have been flipped about the bounds origin |
| 203 | algorithm::expectVerticesHaveBeenFlipped(axis, *patch, oldTexCoords, { patchBounds.origin.x(), patchBounds.origin.y() }); |
| 204 | } |
| 205 | |
| 206 | } |
| 207 |
no test coverage detected