OpenTTD Source 20250205-master-gfd85ab1e2c
|
Tests for consistency/validity of the results of GetPartialPixelZ. More...
#include "../stdafx.h"
#include "../3rdparty/catch2/catch.hpp"
#include "../landscape.h"
#include "../slope_func.h"
Go to the source code of this file.
Functions | |
bool | CheckPartialPixelZSlopeAddition (Slope slope_expected, Slope slope_a, Slope slope_b) |
Check whether the addition of two slope's GetPartialPixelZ values results in the GetPartialPixelZ values of the expected slope. | |
TEST_CASE ("PartialPixelSlopeAdditionTest - A one corner slope, plus the opposite three corner slope results in a flat but elevated slope") | |
TEST_CASE ("PartialPixelSlopeAdditionTest - Diagonal slopes with their opposite slope result in a flat but elevated slope") | |
TEST_CASE ("PartialPixelSlopeAdditionTest - Half tile slopes with their opposite half tile slope result in a flat but elevated slope") | |
TEST_CASE ("PartialPixelSlopeAdditionTest - Two opposite one corner slopes result in the two corner slope with opposite corners") | |
TEST_CASE ("PartialPixelSlopeAdditionTest - A steep slope is a one corner slope on top of a three corner slope") | |
TEST_CASE ("PartialPixelSlopeAdditionTest - A half tile steep slope is a one corner half tile on top of a three corner slope") | |
bool | CheckPartialPixelZ (Slope slope, std::array< int, TILE_SIZE *TILE_SIZE > expected) |
Check whether the partial pixel Z values are the expected values. | |
TEST_CASE ("PartialPixelTest - One corner up slopes - SLOPE_N") | |
TEST_CASE ("PartialPixelTest - One corner up slopes - SLOPE_E") | |
TEST_CASE ("PartialPixelTest - One corner up slopes - SLOPE_S") | |
TEST_CASE ("PartialPixelTest - One corner up slopes - SLOPE_W") | |
TEST_CASE ("PartialPixelTest - Two corner up, diagonal slopes - SLOPE_NE") | |
TEST_CASE ("PartialPixelTest - Two corner up, diagonal slopes - SLOPE_SE") | |
TEST_CASE ("PartialPixelTest - Two corner up, diagonal slopes - SLOPE_SW") | |
TEST_CASE ("PartialPixelTest - Two corner up, diagonal slopes - SLOPE_NW") | |
TEST_CASE ("PartialPixelTest - Two opposite corner up slopes - SLOPE_NS") | |
TEST_CASE ("PartialPixelTest - Two opposite corner up slopes - SLOPE_EW") | |
TEST_CASE ("PartialPixelTest - Three corner up slopes - SLOPE_ENW") | |
TEST_CASE ("PartialPixelTest - Three corner up slopes - SLOPE_SEN") | |
TEST_CASE ("PartialPixelTest - Three corner up slopes - SLOPE_WSE") | |
TEST_CASE ("PartialPixelTest - Three corner up slopes - SLOPE_NWS") | |
TEST_CASE ("PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_N") | |
TEST_CASE ("PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_E") | |
TEST_CASE ("PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_S") | |
TEST_CASE ("PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_W") | |
TEST_CASE ("PartialPixelTest - Steep slopes - SLOPE_STEEP_N") | |
TEST_CASE ("PartialPixelTest - Steep slopes - SLOPE_STEEP_E") | |
TEST_CASE ("PartialPixelTest - Steep slopes - SLOPE_STEEP_S") | |
TEST_CASE ("PartialPixelTest - Steep slopes - SLOPE_STEEP_W") | |
TEST_CASE ("PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_N") | |
TEST_CASE ("PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_E") | |
TEST_CASE ("PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_S") | |
TEST_CASE ("PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_W") | |
Tests for consistency/validity of the results of GetPartialPixelZ.
Definition in file landscape_partial_pixel_z.cpp.
Check whether the partial pixel Z values are the expected values.
The arrays are as if the map is rotated 45 degrees counterclockwise.
slope | The slope that is to be checked. |
expected | The expect partial pixels Z values. |
Definition at line 88 of file landscape_partial_pixel_z.cpp.
References GB(), and GetPartialPixelZ().
Check whether the addition of two slope's GetPartialPixelZ values results in the GetPartialPixelZ values of the expected slope.
This iterates over all sub-pixel locations within a single tile.
slope_expected | The slope that is expected. |
slope_a | The first slope of the addition. |
slope_b | The second slope of the addition. |
Definition at line 26 of file landscape_partial_pixel_z.cpp.
References GetPartialPixelZ(), and TILE_SIZE.
TEST_CASE | ( | "PartialPixelSlopeAdditionTest - A half tile steep slope is a one corner half tile on top of a three corner slope" | ) |
Definition at line 73 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelSlopeAdditionTest - A one corner | slope, |
plus the opposite three corner slope results in a flat but elevated slope" | |||
) |
Definition at line 39 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelSlopeAdditionTest - A steep slope is a one corner slope on top of a three corner slope" | ) |
Definition at line 65 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelSlopeAdditionTest - Diagonal slopes with their opposite slope result in a flat but elevated slope" | ) |
Definition at line 47 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelSlopeAdditionTest - Half tile slopes with their opposite half tile slope result in a flat but elevated slope" | ) |
Definition at line 53 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelSlopeAdditionTest - Two opposite one corner slopes result in the two corner slope with opposite corners" | ) |
Definition at line 59 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_E" | ) |
Definition at line 580 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_N" | ) |
Definition at line 559 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_S" | ) |
Definition at line 601 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Half tile on top of steep slopes - SLOPE_STEEP/CORNER_W" | ) |
Definition at line 622 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_E" | ) |
Definition at line 412 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_N" | ) |
Definition at line 391 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_S" | ) |
Definition at line 433 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Normal half tile slopes - SLOPE/CORNER_W" | ) |
Definition at line 454 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - One corner up slopes - SLOPE_E" | ) |
Definition at line 118 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - One corner up slopes - SLOPE_N" | ) |
Definition at line 97 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - One corner up slopes - SLOPE_S" | ) |
Definition at line 139 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - One corner up slopes - SLOPE_W" | ) |
Definition at line 160 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Steep slopes - SLOPE_STEEP_E" | ) |
Definition at line 496 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Steep slopes - SLOPE_STEEP_N" | ) |
Definition at line 475 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Steep slopes - SLOPE_STEEP_S" | ) |
Definition at line 517 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Steep slopes - SLOPE_STEEP_W" | ) |
Definition at line 538 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Three corner up slopes - SLOPE_ENW" | ) |
Definition at line 307 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Three corner up slopes - SLOPE_NWS" | ) |
Definition at line 370 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Three corner up slopes - SLOPE_SEN" | ) |
Definition at line 328 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Three corner up slopes - SLOPE_WSE" | ) |
Definition at line 349 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Two corner | up, |
diagonal slopes - SLOPE_NE" | |||
) |
Definition at line 181 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Two corner | up, |
diagonal slopes - SLOPE_NW" | |||
) |
Definition at line 244 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Two corner | up, |
diagonal slopes - SLOPE_SE" | |||
) |
Definition at line 202 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Two corner | up, |
diagonal slopes - SLOPE_SW" | |||
) |
Definition at line 223 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Two opposite corner up slopes - SLOPE_EW" | ) |
Definition at line 286 of file landscape_partial_pixel_z.cpp.
TEST_CASE | ( | "PartialPixelTest - Two opposite corner up slopes - SLOPE_NS" | ) |
Definition at line 265 of file landscape_partial_pixel_z.cpp.