#159 Add test case for rotated and moved matrix

This commit is contained in:
Jacek Olszak 2019-02-12 16:26:19 +01:00
parent 3b366d1edd
commit a0713598da
1 changed files with 6 additions and 0 deletions

View File

@ -100,6 +100,12 @@ func TestMatrix_Unproject(t *testing.T) {
assert.InDelta(t, unprojected.X, 2, delta)
assert.InDelta(t, unprojected.Y, 2, delta)
})
t.Run("for rotated and moved matrix", func(t *testing.T) {
matrix := pixel.IM.Rotated(pixel.ZV, math.Pi/2).Moved(pixel.V(1, 1))
unprojected := matrix.Unproject(pixel.V(1, 2))
assert.InDelta(t, unprojected.X, 1, delta)
assert.InDelta(t, unprojected.Y, 0, delta)
})
t.Run("for singular matrix", func(t *testing.T) {
matrix := pixel.Matrix{0, 0, 0, 0, 0, 0}
unprojected := matrix.Unproject(pixel.ZV)