Werner Lemberg pushed to branch master at FreeType / FreeType
Commits:
-
7bc0f48c
by Alex Richardson at 2021-07-16T14:42:51+02:00
3 changed files:
Changes:
1 |
+2021-07-16 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
|
|
2 |
+ |
|
3 |
+ [tests] Allow arbitrary build directories.
|
|
4 |
+ |
|
5 |
+ * tests/issue-1063/main.c (main): I am building with a build
|
|
6 |
+ directory that is not directly inside the source tree, so the path
|
|
7 |
+ `../tests/data/As.I.Lay.Dying.ttf` does not resolve to the test
|
|
8 |
+ input file. This change passes the test data directory as an
|
|
9 |
+ environment variable to allow arbitrary build directories.
|
|
10 |
+ |
|
11 |
+ * tests/meson.build: Updated.
|
|
12 |
+ |
|
1 | 13 |
2021-07-15 Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
|
2 | 14 |
|
3 | 15 |
* tests/issue-1063/main.c (main): Fix uninitialized variable.
|
1 |
+#include <limits.h>
|
|
1 | 2 |
#include <stdio.h>
|
2 | 3 |
|
3 | 4 |
#include <freetype/freetype.h>
|
4 | 5 |
#include <ft2build.h>
|
5 | 6 |
|
7 |
+ |
|
6 | 8 |
int
|
7 | 9 |
main( void )
|
8 | 10 |
{
|
9 |
- FT_Library library;
|
|
10 |
- FT_Face face = NULL;
|
|
11 |
+ FT_Library library;
|
|
12 |
+ FT_Face face = NULL;
|
|
13 |
+ |
|
14 |
+ /*
|
|
15 |
+ * We assume that `FREETYPE_TESTS_DATA_DIR` was set by `meson test`.
|
|
16 |
+ * Otherwise we default to `../tests/data`.
|
|
17 |
+ *
|
|
18 |
+ * TODO (David): Rewrite this to pass the test directory through the
|
|
19 |
+ * command-line.
|
|
20 |
+ */
|
|
21 |
+ const char* testdata_dir = getenv( "FREETYPE_TESTS_DATA_DIR" );
|
|
22 |
+ char filepath[PATH_MAX];
|
|
23 |
+ |
|
11 | 24 |
|
12 |
- /* Assumes this is run from out/ build directory though 'meson test -C out' */
|
|
13 |
- const char* filepath = "../tests/data/As.I.Lay.Dying.ttf";
|
|
25 |
+ snprintf( filepath, sizeof( filepath ), "%s/%s",
|
|
26 |
+ testdata_dir ? testdata_dir : "../tests/data",
|
|
27 |
+ "As.I.Lay.Dying.ttf" );
|
|
14 | 28 |
|
15 | 29 |
FT_Init_FreeType( &library );
|
16 | 30 |
if ( FT_New_Face( library, filepath, 0, &face ) != 0 )
|
... | ... | @@ -19,13 +33,17 @@ main( void ) |
19 | 33 |
return 1;
|
20 | 34 |
}
|
21 | 35 |
|
22 |
- for ( FT_ULong i = 59; i < 171; i++ )
|
|
36 |
+ for ( FT_ULong i = 59; i < 171; i++ )
|
|
23 | 37 |
{
|
24 |
- FT_UInt gid = FT_Get_Char_Index( face, i );
|
|
25 |
- FT_Error code = FT_Load_Glyph( face, gid, FT_LOAD_DEFAULT );
|
|
38 |
+ FT_UInt gid = FT_Get_Char_Index( face, i );
|
|
39 |
+ FT_Error code = FT_Load_Glyph( face, gid, FT_LOAD_DEFAULT );
|
|
40 |
+ |
|
41 |
+ |
|
26 | 42 |
if ( code )
|
27 | 43 |
printf( "unknown %d for char %lu, gid %u\n", code, i, gid );
|
28 | 44 |
}
|
29 | 45 |
|
30 | 46 |
return 0;
|
31 | 47 |
}
|
48 |
+ |
|
49 |
+/* EOF */
|
... | ... | @@ -3,5 +3,12 @@ test_issue_1063 = executable('issue-1063', |
3 | 3 |
dependencies: freetype_dep,
|
4 | 4 |
)
|
5 | 5 |
|
6 |
-test('issue-1063', test_issue_1063, suite: 'regression')
|
|
6 |
+test_env = ['FREETYPE_TESTS_DATA_DIR='
|
|
7 |
+ + join_paths(meson.current_source_dir(), 'data')]
|
|
7 | 8 |
|
9 |
+test('issue-1063',
|
|
10 |
+ test_issue_1063,
|
|
11 |
+ env: test_env,
|
|
12 |
+ suite: 'regression')
|
|
13 |
+ |
|
14 |
+# EOF
|