aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-02-25 14:58:22 +0000
committerTom Hacohen <tom@stosb.com>2013-02-25 14:59:03 +0000
commit9696f44a67bba5a00b244d3e1070f27ce8676069 (patch)
tree8a9c3d50be4ef6a8cf74e1478128954ecb57d62a /src
parent1b5ffada1b2d6f4ed7e9a094cbdcdfdf24dc2c2b (diff)
downloadefl-9696f44a67bba5a00b244d3e1070f27ce8676069.tar.gz
efl-9696f44a67bba5a00b244d3e1070f27ce8676069.tar.xz
efl-9696f44a67bba5a00b244d3e1070f27ce8676069.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Evas.am4
-rw-r--r--src/tests/evas/DejaVuSans.eetbin0 -> 361378 bytes
-rw-r--r--src/tests/evas/evas_test_text.c16
-rw-r--r--src/tests/evas/evas_test_textblock.c10
4 files changed, 22 insertions, 8 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 8b2a53bb7..0a72fef71 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -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
diff --git a/src/tests/evas/DejaVuSans.eet b/src/tests/evas/DejaVuSans.eet
new file mode 100644
index 000000000..de01dad91
--- /dev/null
+++ b/src/tests/evas/DejaVuSans.eet
Binary files differ
diff --git a/src/tests/evas/evas_test_text.c b/src/tests/evas/evas_test_text.c
index b94ff256e..dc72a592f 100644
--- a/src/tests/evas/evas_test_text.c
+++ b/src/tests/evas/evas_test_text.c
@@ -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);
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index c8dac7344..20b31e8de 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -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'");