Skip to content

Commit

Permalink
Update freetype test. NFC (#22583)
Browse files Browse the repository at this point in the history
Specifically this change allows us to run `--rebase` to update the
expected output.
  • Loading branch information
sbc100 authored Sep 18, 2024
1 parent af2bc13 commit 645750c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
3 changes: 1 addition & 2 deletions test/freetype_test.c → test/test_freetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ main( int argc,
int target_height;
int n, num_chars;

filename = "LiberationSansBold.ttf";
filename = "LiberationSansBold.ttf";
text = "w";
num_chars = strlen( text );
WIDTH = 16;
Expand Down Expand Up @@ -143,6 +143,5 @@ main( int argc,
FT_Done_Face ( face );
FT_Done_FreeType( library );


return 0;
}
16 changes: 16 additions & 0 deletions test/test_freetype.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@




*** +***+
***+ ***** +
+**+ ***** +
+*** +**+**+ *
***+ ***+**+ +*
+**+ *** *** +*
+**++**+ +**+**
***+**+ +**+**
****** *****
+****+ +****
+****+ +****
**** ****
29 changes: 6 additions & 23 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2487,34 +2487,17 @@ def test_freetype(self):
# copy the Liberation Sans Bold truetype file located in the
# <emscripten_root>/test/freetype to the compilation folder
shutil.copy2(test_file('freetype/LiberationSansBold.ttf'), os.getcwd())
self.emcc_args += ['--embed-file', 'LiberationSansBold.ttf']
# the test program will print an ascii representation of a bitmap where the
# 'w' character has been rendered using the Liberation Sans Bold font
expectedOutput = ' \n' + \
' \n' + \
' \n' + \
' \n' + \
'*** +***+ \n' + \
'***+ ***** +\n' + \
'+**+ ***** +\n' + \
'+*** +**+**+ *\n' + \
' ***+ ***+**+ +*\n' + \
' +**+ *** *** +*\n' + \
' +**++**+ +**+**\n' + \
' ***+**+ +**+**\n' + \
' ****** *****\n' + \
' +****+ +****\n' + \
' +****+ +****\n' + \
' **** ****'
# build test program with the font file embed in it
self.do_runf('freetype_test.c', expectedOutput,
emcc_args=['-sUSE_FREETYPE', '--embed-file', 'LiberationSansBold.ttf'])
self.do_runf('freetype_test.c', expectedOutput,
emcc_args=['--use-port=freetype', '--embed-file', 'LiberationSansBold.ttf'])
# 'w' character has been rendered using the Liberation Sans Bold font.
# See test_freetype.out
self.do_run_in_out_file_test('test_freetype.c', emcc_args=['-sUSE_FREETYPE'])
self.do_run_in_out_file_test('test_freetype.c', emcc_args=['--use-port=freetype'])

@requires_network
def test_freetype_with_pthreads(self):
# Verify that freetype supports compilation requiring pthreads
self.emcc(test_file('freetype_test.c'), ['-pthread', '-sUSE_FREETYPE'], output_filename='a.out.js')
self.emcc(test_file('test_freetype.c'), ['-pthread', '-sUSE_FREETYPE'], output_filename='a.out.js')

@requires_network
def test_icu(self):
Expand Down

0 comments on commit 645750c

Please sign in to comment.