Last active
August 29, 2015 14:23
-
-
Save dead/e8734193b74d0f84a008 to your computer and use it in GitHub Desktop.
test_core diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- test_core.old.py 2015-06-25 08:23:46.468211660 -0300 | |
+++ tests/test_core.py 2015-06-25 08:23:35.380211692 -0300 | |
@@ -5627,7 +5627,7 @@ | |
Settings.DEAD_FUNCTIONS += ['_inflateEnd', '_inflate', '_inflateReset', '_inflateInit2_'] | |
return self.get_library('freetype', | |
- os.path.join('objs', '.libs', 'libfreetype.a')) | |
+ os.path.join('objs', '.libs', 'libfreetype.so')) | |
def test_freetype(self): | |
assert 'asm2g' in test_modes | |
@@ -5647,6 +5647,22 @@ | |
open(filename, 'w').write(src) | |
''' | |
+ post_out = ''' | |
+def process(filename): | |
+ import tools.shared as shared | |
+ # Embed the font into the document | |
+ src = open(filename, 'r').read().replace( | |
+ '// {{PRE_RUN_ADDITIONS}}', | |
+ "FS.createDataFile('/', 'font.ttf', %s, true, false);" % str( | |
+ map(ord, open(shared.path_from_root('tests', 'freetype', 'LiberationSansBold.ttf'), 'rb').read()) | |
+ ) | |
+ ).replace( | |
+ '// {{POST_RUN_ADDITIONS}}', | |
+ "Module.print(JSON.stringify(MEMFS.getFileDataAsRegularArray(FS.analyzePath('out.tga').object)));" | |
+ ) | |
+ open(filename, 'w').write(src) | |
+''' | |
+ | |
# Not needed for js, but useful for debugging | |
shutil.copyfile(path_from_root('tests', 'freetype', 'LiberationSansBold.ttf'), os.path.join(self.get_dir(), 'font.ttf')) | |
@@ -5683,6 +5699,29 @@ | |
open(path_from_root('tests', 'freetype', 'ref_4.txt'), 'r').read(), | |
['font.ttf', 'ea', '40', '32', '0'], | |
no_build=True) | |
+ | |
+ def image_compare_freetype(output, err): | |
+ m = re.search('\[[\d, -]*\]', output) | |
+ try: | |
+ js_data = eval(m.group(0)) | |
+ except AttributeError: | |
+ print 'Failed to find proper image output in: ' + output | |
+ raise | |
+ | |
+ js_data = str(bytearray(map(lambda x: x if x >= 0 else 256+x, js_data))) | |
+ true_data = open(path_from_root('tests', 'freetype', 'ref.tga'), 'rb').read() | |
+ open(path_from_root('tests', 'freetype', 'out.tga'), 'wb').write(js_data) | |
+ assert(len(js_data) == len(true_data)) | |
+ assert(js_data == true_data) | |
+ return 'OK' | |
+ | |
+ print '[issue 3576]' | |
+ self.do_run(open(path_from_root('tests', 'freetype', 'main_4.cpp'), 'r').read(), | |
+ 'OK', | |
+ ['font.ttf','out.tga'], | |
+ libraries=self.get_freetype(), | |
+ includes=[path_from_root('tests', 'freetype', 'include')], | |
+ post_build=post_out, output_nicerizer=image_compare_freetype) | |
def test_sqlite(self): | |
# gcc -O3 -I/home/alon/Dev/emscripten/tests/sqlite -ldl src.c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment