summaryrefslogtreecommitdiff
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
parent1b5ffada1b2d6f4ed7e9a094cbdcdfdf24dc2c2b (diff)
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.
-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 8b2a53bb77..0a72fef71e 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -1557,9 +1557,13 @@ tests/evas/evas_tests_helpers.h \
1557tests/evas/evas_suite.h 1557tests/evas/evas_suite.h
1558 1558
1559tests_evas_evas_suite_CPPFLAGS = \ 1559tests_evas_evas_suite_CPPFLAGS = \
1560-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas\" \
1560@CHECK_CFLAGS@ \ 1561@CHECK_CFLAGS@ \
1561@EVAS_CFLAGS@ 1562@EVAS_CFLAGS@
1562 1563
1563tests_evas_evas_suite_LDADD = @CHECK_LIBS@ @USE_EVAS_LIBS@ 1564tests_evas_evas_suite_LDADD = @CHECK_LIBS@ @USE_EVAS_LIBS@
1564tests_evas_evas_suite_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@ 1565tests_evas_evas_suite_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
1565endif 1566endif
1567
1568EXTRA_DIST += \
1569DejaVuSans.eet
diff --git a/src/tests/evas/DejaVuSans.eet b/src/tests/evas/DejaVuSans.eet
new file mode 100644
index 0000000000..de01dad916
--- /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 b94ff256e7..dc72a592f6 100644
--- a/src/tests/evas/evas_test_text.c
+++ b/src/tests/evas/evas_test_text.c
@@ -9,12 +9,16 @@
9#include "Evas.h" 9#include "Evas.h"
10#include "evas_tests_helpers.h" 10#include "evas_tests_helpers.h"
11 11
12#define TEST_FONT_NAME "TEST_FONT"
13#define TEST_FONT_SOURCE TESTS_SRC_DIR "./DejaVuSans.eet"
14
12#define START_TEXT_TEST() \ 15#define START_TEXT_TEST() \
13 Evas *evas; \ 16 Evas *evas; \
14 Evas_Object *to; \ 17 Evas_Object *to; \
15 evas = EVAS_TEST_INIT_EVAS(); \ 18 evas = EVAS_TEST_INIT_EVAS(); \
16 evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); \ 19 evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); \
17 to = evas_object_text_add(evas); \ 20 to = evas_object_text_add(evas); \
21 evas_object_text_font_source_set(to, TEST_FONT_SOURCE); \
18do \ 22do \
19{ \ 23{ \
20} \ 24} \
@@ -44,7 +48,7 @@ START_TEST(evas_text_geometries)
44{ 48{
45 START_TEXT_TEST(); 49 START_TEXT_TEST();
46 const char *buf = "Tests"; 50 const char *buf = "Tests";
47 const char *font = "Sans"; 51 const char *font = TEST_FONT_NAME;
48 Evas_Font_Size size = 14; 52 Evas_Font_Size size = 14;
49 Evas_Coord prev; 53 Evas_Coord prev;
50 int i; 54 int i;
@@ -144,7 +148,7 @@ START_TEST(evas_text_evas)
144 Evas_Coord w, h, bw, bh; 148 Evas_Coord w, h, bw, bh;
145 START_TEXT_TEST(); 149 START_TEXT_TEST();
146 const char *buf = "Test - בדיקה"; 150 const char *buf = "Test - בדיקה";
147 const char *font = "Sans"; 151 const char *font = TEST_FONT_NAME;
148 Evas_Font_Size size = 14; 152 Evas_Font_Size size = 14;
149 153
150 evas_object_text_font_set(to, font, size); 154 evas_object_text_font_set(to, font, size);
@@ -214,19 +218,19 @@ START_TEST(evas_text_set_get)
214 _CHECK_SET_GET(outline_color); 218 _CHECK_SET_GET(outline_color);
215 219
216 /* Font and size */ 220 /* Font and size */
217 const char *font = "Sans"; 221 const char *font = TEST_FONT_NAME;
218 Evas_Font_Size size = 14; 222 Evas_Font_Size size = 14;
219 evas_object_text_font_set(to, font, size); 223 evas_object_text_font_set(to, font, size);
220 font = NULL; 224 font = NULL;
221 size = 0; 225 size = 0;
222 evas_object_text_font_get(to, &font, &size); 226 evas_object_text_font_get(to, &font, &size);
223 fail_if(strcmp(font, "Sans")); 227 fail_if(strcmp(font, TEST_FONT_NAME));
224 fail_if(size != 14); 228 fail_if(size != 14);
225 evas_object_text_font_set(to, font, size); 229 evas_object_text_font_set(to, font, size);
226 font = NULL; 230 font = NULL;
227 size = 0; 231 size = 0;
228 evas_object_text_font_get(to, &font, &size); 232 evas_object_text_font_get(to, &font, &size);
229 fail_if(strcmp(font, "Sans")); 233 fail_if(strcmp(font, TEST_FONT_NAME));
230 fail_if(size != 14); 234 fail_if(size != 14);
231 235
232 font = "NON-EXISTING-FONT"; 236 font = "NON-EXISTING-FONT";
@@ -350,7 +354,7 @@ START_TEST(evas_text_bidi)
350 const char *buf = "Test - בדיקה"; 354 const char *buf = "Test - בדיקה";
351 int i; 355 int i;
352 Evas_Coord x, y, w, h, px; 356 Evas_Coord x, y, w, h, px;
353 const char *font = "Sans"; 357 const char *font = TEST_FONT_NAME;
354 Evas_Font_Size size = 14; 358 Evas_Font_Size size = 14;
355 359
356 evas_object_text_font_set(to, font, size); 360 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 c8dac7344e..20b31e8de6 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -1,3 +1,8 @@
1/*
2 * TODO:
3 * * Test different font lodaing mechanisms.
4 */
5
1#ifdef HAVE_CONFIG_H 6#ifdef HAVE_CONFIG_H
2# include "config.h" 7# include "config.h"
3#endif 8#endif
@@ -18,9 +23,10 @@ EAPI int
18_evas_textblock_format_offset_get(const Evas_Object_Textblock_Node_Format *n); 23_evas_textblock_format_offset_get(const Evas_Object_Textblock_Node_Format *n);
19/* end of functions defined in evas_object_textblock.c */ 24/* end of functions defined in evas_object_textblock.c */
20 25
26#define TEST_FONT "font=TEST_FONT fount_source" TESTS_SRC_DIR "./DejaVuSans.eet"
21 27
22static const char *style_buf = 28static const char *style_buf =
23 "DEFAULT='font=Sans font_size=10 color=#000 text_class=entry'" 29 "DEFAULT='" TEST_FONT " font_size=10 color=#000 text_class=entry'"
24 "newline='br'" 30 "newline='br'"
25 "b='+ font=Sans:style=bold'"; 31 "b='+ font=Sans:style=bold'";
26 32
@@ -2016,7 +2022,7 @@ START_TEST(evas_textblock_style)
2016 newst = evas_textblock_style_new(); 2022 newst = evas_textblock_style_new();
2017 fail_if(!newst); 2023 fail_if(!newst);
2018 evas_textblock_style_set(newst, 2024 evas_textblock_style_set(newst,
2019 "DEFAULT='font=Sans font_size=20 color=#000 text_class=entry'" 2025 "DEFAULT='" TEST_FONT " font_size=20 color=#000 text_class=entry'"
2020 "br='\n'" 2026 "br='\n'"
2021 "ps='ps'" 2027 "ps='ps'"
2022 "tab='\t'"); 2028 "tab='\t'");