| 148 | } |
| 149 | |
| 150 | void iterateOverPartialPatchColumnWise(IPatch& patch, int startCol, int endCol, bool rowBackwards) |
| 151 | { |
| 152 | std::vector<Vector3> expectedValues; |
| 153 | |
| 154 | // Fill the vector with the expected values |
| 155 | int step = startCol <= endCol ? +1 : -1; |
| 156 | |
| 157 | for (auto col = startCol; col != endCol + step; col += step) |
| 158 | { |
| 159 | if (rowBackwards) |
| 160 | { |
| 161 | for (auto row = static_cast<int>(patch.getHeight()) - 1; row >= 0; --row) |
| 162 | { |
| 163 | expectedValues.push_back(patch.ctrlAt(row, col).vertex); |
| 164 | } |
| 165 | } |
| 166 | else |
| 167 | { |
| 168 | for (auto row = 0; row < patch.getHeight(); ++row) |
| 169 | { |
| 170 | expectedValues.push_back(patch.ctrlAt(row, col).vertex); |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | auto it = !rowBackwards ? |
| 176 | static_cast<patch::PatchControlIterator>(patch::ColumnWisePatchIterator(patch, startCol, endCol)) : |
| 177 | patch::ColumnWisePatchReverseIterator(patch, startCol, endCol); |
| 178 | |
| 179 | auto expected = expectedValues.begin(); |
| 180 | |
| 181 | while (it.isValid()) |
| 182 | { |
| 183 | EXPECT_EQ((it++)->vertex, *(expected++)); |
| 184 | } |
| 185 | |
| 186 | EXPECT_EQ(expected, expectedValues.end()); // assume no underflow |
| 187 | } |
| 188 | |
| 189 | TEST_F(PatchIteratorTest, IterateOverPartialPatchColumnWise) |
| 190 | { |
no test coverage detected