blob: a0744e8bf192777178db778ab3b917bbb7a34b2b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "cru/platform/Matrix.h"
#include "cru/win/graphics/direct/ConvertUtil.h"
#include <catch2/catch_test_macros.hpp>
using cru::platform::Matrix;
using cru::platform::graphics::win::direct::Convert;
TEST_CASE("MatrixConvert Rotation", "[matrix]") {
auto matrix = Convert(Matrix::Rotation(90));
auto m = *D2D1::Matrix3x2F::ReinterpretBaseType(&matrix);
auto p = m.TransformPoint({1, 1});
REQUIRE(p.x == -1);
REQUIRE(p.y == 1);
}
TEST_CASE("MatrixConvert RotationAndTranslation", "[matrix]") {
auto matrix = Convert(Matrix::Rotation(90) * Matrix::Translation(1, 1));
auto m = *D2D1::Matrix3x2F::ReinterpretBaseType(&matrix);
auto p = m.TransformPoint({1, 1});
REQUIRE(p.x == 0);
REQUIRE(p.y == 2);
}
|