diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-12-02 19:51:14 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-12-02 20:24:53 -0500 |
commit | 73f27640b5292dd758e3daf5c88180b8e54e2804 (patch) | |
tree | 7670d8787860c0abae1945bb181753a954cfb1ad /tests | |
parent | 2c0aa8b8d3ac2811479976d6477166592b862458 (diff) | |
download | pango-73f27640b5292dd758e3daf5c88180b8e54e2804.tar.gz |
Add pango_font_deserialize
This will make the font serialization useful
in GTK, where we serialize fonts in node files.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testserialize.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/testserialize.c b/tests/testserialize.c index ed571b69..e480da31 100644 --- a/tests/testserialize.c +++ b/tests/testserialize.c @@ -135,7 +135,10 @@ test_serialize_font (void) PangoContext *context; PangoFontDescription *desc; PangoFont *font; + PangoFont *font2; GBytes *bytes; + GBytes *bytes2; + GError *error = NULL; const char *expected = "{\n" " \"description\" : \"Cantarell 20 @wght=600\",\n" @@ -159,10 +162,20 @@ test_serialize_font (void) bytes = pango_font_serialize (font); g_assert_cmpstr (g_bytes_get_data (bytes, NULL), ==, expected); - g_bytes_unref (bytes); + + font2 = pango_font_deserialize (context, bytes, &error); + g_assert_no_error (error); + g_assert_nonnull (font2); + + bytes2 = pango_font_serialize (font2); + g_assert_true (g_bytes_equal (bytes2, bytes)); g_object_unref (font); + g_object_unref (font2); pango_font_description_free (desc); + + g_bytes_unref (bytes); + g_bytes_unref (bytes2); g_object_unref (context); } |