Evas text tests: Start shipping DejaVuSans with the test suite.

We can finally rely on having fonts in all cases (even when there's no
fontconfig) and we can also rely on specific sizing.
This commit is contained in:
Tom Hacohen 2013-02-25 14:58:22 +00:00
parent 1b5ffada1b
commit 9696f44a67
4 changed files with 22 additions and 8 deletions

View File

@ -1557,9 +1557,13 @@ tests/evas/evas_tests_helpers.h \
tests/evas/evas_suite.h
tests_evas_evas_suite_CPPFLAGS = \
-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas\" \
@CHECK_CFLAGS@ \
@EVAS_CFLAGS@
tests_evas_evas_suite_LDADD = @CHECK_LIBS@ @USE_EVAS_LIBS@
tests_evas_evas_suite_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
endif
EXTRA_DIST += \
DejaVuSans.eet

Binary file not shown.

View File

@ -9,12 +9,16 @@
#include "Evas.h"
#include "evas_tests_helpers.h"
#define TEST_FONT_NAME "TEST_FONT"
#define TEST_FONT_SOURCE TESTS_SRC_DIR "./DejaVuSans.eet"
#define START_TEXT_TEST() \
Evas *evas; \
Evas_Object *to; \
evas = EVAS_TEST_INIT_EVAS(); \
evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); \
to = evas_object_text_add(evas); \
evas_object_text_font_source_set(to, TEST_FONT_SOURCE); \
do \
{ \
} \
@ -44,7 +48,7 @@ START_TEST(evas_text_geometries)
{
START_TEXT_TEST();
const char *buf = "Tests";
const char *font = "Sans";
const char *font = TEST_FONT_NAME;
Evas_Font_Size size = 14;
Evas_Coord prev;
int i;
@ -144,7 +148,7 @@ START_TEST(evas_text_evas)
Evas_Coord w, h, bw, bh;
START_TEXT_TEST();
const char *buf = "Test - בדיקה";
const char *font = "Sans";
const char *font = TEST_FONT_NAME;
Evas_Font_Size size = 14;
evas_object_text_font_set(to, font, size);
@ -214,19 +218,19 @@ START_TEST(evas_text_set_get)
_CHECK_SET_GET(outline_color);
/* Font and size */
const char *font = "Sans";
const char *font = TEST_FONT_NAME;
Evas_Font_Size size = 14;
evas_object_text_font_set(to, font, size);
font = NULL;
size = 0;
evas_object_text_font_get(to, &font, &size);
fail_if(strcmp(font, "Sans"));
fail_if(strcmp(font, TEST_FONT_NAME));
fail_if(size != 14);
evas_object_text_font_set(to, font, size);
font = NULL;
size = 0;
evas_object_text_font_get(to, &font, &size);
fail_if(strcmp(font, "Sans"));
fail_if(strcmp(font, TEST_FONT_NAME));
fail_if(size != 14);
font = "NON-EXISTING-FONT";
@ -350,7 +354,7 @@ START_TEST(evas_text_bidi)
const char *buf = "Test - בדיקה";
int i;
Evas_Coord x, y, w, h, px;
const char *font = "Sans";
const char *font = TEST_FONT_NAME;
Evas_Font_Size size = 14;
evas_object_text_font_set(to, font, size);

View File

@ -1,3 +1,8 @@
/*
* TODO:
* * Test different font lodaing mechanisms.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@ -18,9 +23,10 @@ EAPI int
_evas_textblock_format_offset_get(const Evas_Object_Textblock_Node_Format *n);
/* end of functions defined in evas_object_textblock.c */
#define TEST_FONT "font=TEST_FONT fount_source" TESTS_SRC_DIR "./DejaVuSans.eet"
static const char *style_buf =
"DEFAULT='font=Sans font_size=10 color=#000 text_class=entry'"
"DEFAULT='" TEST_FONT " font_size=10 color=#000 text_class=entry'"
"newline='br'"
"b='+ font=Sans:style=bold'";
@ -2016,7 +2022,7 @@ START_TEST(evas_textblock_style)
newst = evas_textblock_style_new();
fail_if(!newst);
evas_textblock_style_set(newst,
"DEFAULT='font=Sans font_size=20 color=#000 text_class=entry'"
"DEFAULT='" TEST_FONT " font_size=20 color=#000 text_class=entry'"
"br='\n'"
"ps='ps'"
"tab='\t'");