aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/runner.py11
-rw-r--r--tools/file_packager.py6
2 files changed, 14 insertions, 3 deletions
diff --git a/tests/runner.py b/tests/runner.py
index baa9eb5e..49787383 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -8408,6 +8408,17 @@ elif 'browser' in str(sys.argv):
shutil.move('water.dds', 'water.donotfindme.dds') # make sure we load from the compressed
self.btest('s3tc_crunch.c', reference='s3tc_crunch.png', reference_slack=1, args=['--pre-js', 'pre.js'])
+ def test_s3tc_crunch_split(self): # load several datafiles/outputs of file packager
+ shutil.copyfile(path_from_root('tests', 'ship.dds'), 'ship.dds')
+ shutil.copyfile(path_from_root('tests', 'bloom.dds'), 'bloom.dds')
+ shutil.copyfile(path_from_root('tests', 'water.dds'), 'water.dds')
+ Popen(['python', FILE_PACKAGER, 'asset_a.data', '--pre-run', '--crunch', '--preload', 'ship.dds', 'bloom.dds'], stdout=open('asset_a.js', 'w')).communicate()
+ Popen(['python', FILE_PACKAGER, 'asset_b.data', '--pre-run', '--crunch', '--preload', 'water.dds'], stdout=open('asset_b.js', 'w')).communicate()
+ shutil.move('ship.dds', 'ship.donotfindme.dds') # make sure we load from the compressed
+ shutil.move('bloom.dds', 'bloom.donotfindme.dds') # make sure we load from the compressed
+ shutil.move('water.dds', 'water.donotfindme.dds') # make sure we load from the compressed
+ self.btest('s3tc_crunch.c', reference='s3tc_crunch.png', reference_slack=1, args=['--pre-js', 'asset_a.js', '--pre-js', 'asset_b.js'])
+
def test_aniso(self):
shutil.copyfile(path_from_root('tests', 'water.dds'), 'water.dds')
self.btest('aniso.c', reference='aniso.png', reference_slack=2, args=['--preload-file', 'water.dds'])
diff --git a/tools/file_packager.py b/tools/file_packager.py
index 25a920b6..0f6a7093 100644
--- a/tools/file_packager.py
+++ b/tools/file_packager.py
@@ -300,7 +300,7 @@ if has_preloaded:
curr.response = byteArray.subarray(%d,%d);
curr.onload();
''' % (file_['name'], file_['data_start'], file_['data_end'])
- use_data += " Module['removeRunDependency']('datafile');\n"
+ use_data += " Module['removeRunDependency']('datafile_%s');\n" % data_target
if Compression.on:
use_data = '''
@@ -328,10 +328,10 @@ if has_preloaded:
var curr;
%s
};
- Module['addRunDependency']('datafile');
+ Module['addRunDependency']('datafile_%s');
dataFile.send(null);
if (Module['setStatus']) Module['setStatus']('Downloading...');
- ''' % (os.path.basename(Compression.compressed_name(data_target) if Compression.on else data_target), use_data) # use basename because from the browser's point of view, we need to find the datafile in the same dir as the html file
+ ''' % (os.path.basename(Compression.compressed_name(data_target) if Compression.on else data_target), use_data, data_target) # use basename because from the browser's point of view, we need to find the datafile in the same dir as the html file
if pre_run:
print '''