ebiten/graphics/geometry_matrix_test.go

62 lines
1.1 KiB
Go
Raw Normal View History

2013-06-15 10:07:14 +02:00
package graphics_test
import (
. "."
2013-06-19 16:51:41 +02:00
"testing"
2013-06-15 10:07:14 +02:00
)
func TestGeometryMatrixElements(t *testing.T) {
matrix := NewGeometryMatrix()
matrix.SetA(1)
matrix.SetB(2)
matrix.SetC(3)
matrix.SetD(4)
matrix.SetTx(5)
matrix.SetTy(6)
got := matrix.A()
2013-06-19 02:33:26 +02:00
want := float64(1)
2013-06-15 10:07:14 +02:00
if want != got {
t.Errorf("matrix.A() = %f, want %f", got, want)
}
got = matrix.B()
2013-06-19 02:33:26 +02:00
want = float64(2)
2013-06-15 10:07:14 +02:00
if want != got {
t.Errorf("matrix.B() = %f, want %f", got, want)
}
got = matrix.C()
2013-06-19 02:33:26 +02:00
want = float64(3)
2013-06-15 10:07:14 +02:00
if want != got {
t.Errorf("matrix.C() = %f, want %f", got, want)
}
got = matrix.D()
2013-06-19 02:33:26 +02:00
want = float64(4)
2013-06-15 10:07:14 +02:00
if want != got {
t.Errorf("matrix.D() = %f, want %f", got, want)
}
got = matrix.Tx()
2013-06-19 02:33:26 +02:00
want = float64(5)
2013-06-15 10:07:14 +02:00
if want != got {
t.Errorf("matrix.Tx() = %f, want %f", got, want)
}
got = matrix.Ty()
2013-06-19 02:33:26 +02:00
want = float64(6)
2013-06-15 10:07:14 +02:00
if want != got {
t.Errorf("matrix.Ty() = %f, want %f", got, want)
}
}
func TestGeometryIdentity(t *testing.T) {
matrix := IdentityGeometryMatrix()
got := matrix.IsIdentity()
want := true
if want != got {
t.Errorf("matrix.IsIdentity() = %t, want %t", got, want)
}
}