diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-01-02 18:49:34 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-01-02 18:49:34 +0000 |
commit | e7147f503495aa88299ca597382c4a4584ea268e (patch) | |
tree | 01af735f9e717c0184e180da59e9c66c8f493f2b /tests | |
parent | fc46f12754e9035c71da2747be55361ddfcf7635 (diff) | |
parent | 1a553ba64c43c13e37d54f1fb20a656ffb2ef067 (diff) | |
download | pango-e7147f503495aa88299ca597382c4a4584ea268e.tar.gz |
Merge branch 'synthetic-slant' into 'main'
Pass synthetic slant to harfbuzz
See merge request GNOME/pango!474
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testmatrix.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/testmatrix.c b/tests/testmatrix.c index 607f2b5f..1ba79839 100644 --- a/tests/testmatrix.c +++ b/tests/testmatrix.c @@ -21,6 +21,7 @@ #include <glib.h> #include <pango/pango.h> +#include <math.h> #define matrix_equal(m1, m2) \ (G_APPROX_VALUE ((m1)->xx, (m2)->xx, 0.0001) && \ @@ -185,6 +186,30 @@ test_matrix_transform_pixel_rect (void) g_assert_cmpfloat_with_epsilon (rect.height, 2, 0.1); } +static void +test_matrix_slant_ratio (void) +{ + PangoMatrix m = (PangoMatrix) { 1, 0, 0.2, 1, 0, 0 }; + PangoMatrix m2 = (PangoMatrix) { 1, 0.4, 0, 1, 0, 0 }; + double r; + + r = pango_matrix_get_slant_ratio (&m); + g_assert_cmphex (r, ==, 0.2); + + pango_matrix_rotate (&m, 45); + + r = pango_matrix_get_slant_ratio (&m); + g_assert_cmphex (r, ==, 0.2); + + pango_matrix_scale (&m, 2, 3); + + r = pango_matrix_get_slant_ratio (&m); + g_assert_cmphex (r, ==, 0.2); + + r = pango_matrix_get_slant_ratio (&m2); + g_assert_cmphex (r, ==, 0.4); +} + int main (int argc, char *argv[]) { @@ -199,6 +224,7 @@ main (int argc, char *argv[]) g_test_add_func ("/matrix/transform-distance", test_matrix_transform_distance); g_test_add_func ("/matrix/transform-rect", test_matrix_transform_rect); g_test_add_func ("/matrix/transform-pixel-rect", test_matrix_transform_pixel_rect); + g_test_add_func ("/matrix/slant-ratio", test_matrix_slant_ratio); return g_test_run (); } |