Change pdfTransform to asAffine.
http://codereview.appspot.com/4704044/
git-svn-id: http://skia.googlecode.com/svn/trunk@1851 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index 4125f9f..5eada0e 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -117,6 +117,30 @@
m.rectStaysRect() == gRectStaysRectSamples[i].mStaysRect);
}
}
+
+ mat.set(SkMatrix::kMScaleX, SkIntToScalar(1));
+ mat.set(SkMatrix::kMSkewX, SkIntToScalar(2));
+ mat.set(SkMatrix::kMTransX, SkIntToScalar(3));
+ mat.set(SkMatrix::kMSkewY, SkIntToScalar(4));
+ mat.set(SkMatrix::kMScaleY, SkIntToScalar(5));
+ mat.set(SkMatrix::kMTransY, SkIntToScalar(6));
+ mat.set(SkMatrix::kMPersp0, SkIntToScalar(0));
+ mat.set(SkMatrix::kMPersp1, SkIntToScalar(0));
+ mat.set(SkMatrix::kMPersp2, SkIntToScalar(1));
+ SkScalar affine[6];
+ REPORTER_ASSERT(reporter, mat.asAffine(affine));
+
+ #define affineEqual(e) affine[SkMatrix::kA##e] == mat.get(SkMatrix::kM##e)
+ REPORTER_ASSERT(reporter, affineEqual(ScaleX));
+ REPORTER_ASSERT(reporter, affineEqual(SkewY));
+ REPORTER_ASSERT(reporter, affineEqual(SkewX));
+ REPORTER_ASSERT(reporter, affineEqual(ScaleY));
+ REPORTER_ASSERT(reporter, affineEqual(TransX));
+ REPORTER_ASSERT(reporter, affineEqual(TransY));
+ #undef affineEqual
+
+ mat.set(SkMatrix::kMPersp1, SkIntToScalar(1));
+ REPORTER_ASSERT(reporter, !mat.asAffine(affine));
}
#include "TestClassDef.h"