commit cdec549cd7caffe5305358bf64a43a5f4728759d
parent e304c61f051c56ad3a83c7076c71f619e1fceb1a
Author: Johannes Lorenz <johannes89@ist-einmalig.de>
Date: Sat, 11 Nov 2017 20:03:58 +0100
Add SaveOSC test to the official tests
Details:
* Fix bug in SaveOSC test that would overwrite the input xmz file
* Add SaveOSC (currently only with Arpeggio 1) test to the official tests
Diffstat:
5 files changed, 16 insertions(+), 85 deletions(-)
diff --git a/TODO-default-values.txt b/TODO-default-values.txt
@@ -0,0 +1,12 @@
+TODOs for default values:
+* use b (or #?) for bundles, not a
+* code for random port ("init() to random")
+* remove rDefaultMissing if possible
+* auto range-print
+move code:
+ports.cpp => default_values.cpp
+rtosc.cpp => ...cmp.cpp?
+test:
+* zyn fx (all presets)
+* rtosc arg val maths
+fix all new todos
diff --git a/TODO.txt b/TODO.txt
@@ -1,12 +0,0 @@
-TODOs for default values:
-* iterate correctly over arrays
-* use b (or #?) for bundles, not a
-* code for random port ("init() to random")
-* remove rDefaultMissing if possible
-move code:
-ports.cpp => default_values.cpp
-rtosc.cpp => ...cmp.cpp?
-test:
-* zyn fx (all presets)
-* rtosc arg val maths
-fix all new todos
diff --git a/src/Tests/CMakeLists.txt b/src/Tests/CMakeLists.txt
@@ -69,7 +69,8 @@ target_link_libraries(save-osc
zynaddsubfx_core zynaddsubfx_nio
zynaddsubfx_gui_bridge
${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES})
-
+#this will be replace with a for loop when the code will get more stable:
+add_test(SaveOsc save-osc ../../../instruments/examples/Arpeggio\ 1.xmz)
#message(STATUS "Plugin Test ${GUI_LIBRARIES} ${NIO_LIBRARIES} ${AUDIO_LIBRARIES}")
diff --git a/src/Tests/SaveOSC.cpp b/src/Tests/SaveOSC.cpp
@@ -145,7 +145,8 @@ class SaveOSCTest
// There is actually no need to wait for /save_osc, since
// we're in the "UI" thread which does the saving itself,
// but this gives an example how it works with remote fron-ends
- rval = timeOutOperation("/save_osc", filename, 1000)
+ // The filename '""' will write the savefile to stdout
+ rval = timeOutOperation("/save_osc", "", 1000)
? EXIT_SUCCESS
: EXIT_FAILURE;
}
diff --git a/src/Tests/load_omz.cpp b/src/Tests/load_omz.cpp
@@ -1,71 +0,0 @@
-#include "../Misc/Master.h"
-
-#include <cassert>
-
-void check_files_are_equal(const char* lfilename, const char* rfilename)
-{
- const int BUFFER_SIZE = 16 * 1024;
-
- std::ifstream lFile(lfilename);
- std::ifstream rFile(rfilename);
- assert(lFile.is_open());
- assert(rFile.is_open());
-
- char lBuffer[BUFFER_SIZE];
- char rBuffer[BUFFER_SIZE];
- do {
- lFile.read(lBuffer, BUFFER_SIZE);
- rFile.read(rBuffer, BUFFER_SIZE);
- numberOfRead = lFile.gcount();//I check the files with the same size
- assert(numberOfRead == rFile.gcount());
-
- if (memcmp(lBuffer, rBuffer, numberOfRead) != 0)
- {
-// memset(lBuffer,0,numberOfRead);
-// memset(rBuffer,0,numberOfRead);
- return false;
- }
- } while (lFile.good() || rFile.good());
-}
-
-int main()
-{
- assert(argc == 2);
- const char *filename = argv[1];
-
- const char* tmp_omz = "/tmp/zynaddsubfx_test_master.omz";
- const char* tmp_xmz = "/tmp/zynaddsubfx_test_master.xmz";
-
- {
- Master master;
-
- int tmp = master.loadXML(filename);
- if(tmp < 0) {
- cerr << "ERROR: Could not load master file " << filename
- << "." << endl;
- exit(1);
- }
-
- master.saveOSC(tmp_omz);
- }
-
- {
- Master master;
-
- master.loadOSC(tmp_omz);
-
- master.saveXML(tmp_xmz);
- if(tmp < 0) {
- cerr << "ERROR: Could not save master file " << tmp_xmz
- << "." << endl;
- exit(1);
- }
-
- }
-
- if(check_files_are_equal(filename, tmp_xmz))
- return 0;
- else
- return 1;
-
-}