From b502c26edcfae7a1ed8df928eb450d67223b7b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Sun, 15 Jan 2017 21:22:12 +0100 Subject: Make all the tests use the drumkit_creator functions. --- .gitignore | 1 + test/Makefile.am | 35 +- test/audiocachefiletest.cc | 12 +- test/audiocachetest.cc | 34 +- test/drumkitcreatortest.cc | 58 +++ test/enginetest.cc | 18 +- test/kit/0000.wav | Bin 46 -> 0 bytes test/kit/1111.wav | Bin 46 -> 0 bytes test/kit/2222.wav | Bin 46 -> 0 bytes test/kit/ffff.wav | Bin 46 -> 0 bytes test/kit/huge_instr.xml | 755 -------------------------------------- test/kit/huge_kit.xml | 770 --------------------------------------- test/kit/instr1.xml | 16 - test/kit/instr2.xml | 16 - test/kit/kit1.xml | 23 -- test/kit/kit2.xml | 23 -- test/kit/midimap.xml | 5 - test/kit/ride-multi-channel.wav | Bin 28591492 -> 0 bytes test/kit/ride-single-channel.wav | Bin 694144 -> 0 bytes test/kit/small_instr.xml | 20 - test/kit/small_kit.xml | 35 -- test/lv2.cc | 31 +- test/memcheckertest.cc | 8 +- test/resource_test.cc | 6 +- 24 files changed, 164 insertions(+), 1702 deletions(-) create mode 100644 test/drumkitcreatortest.cc delete mode 100644 test/kit/0000.wav delete mode 100644 test/kit/1111.wav delete mode 100644 test/kit/2222.wav delete mode 100644 test/kit/ffff.wav delete mode 100644 test/kit/huge_instr.xml delete mode 100644 test/kit/huge_kit.xml delete mode 100644 test/kit/instr1.xml delete mode 100644 test/kit/instr2.xml delete mode 100644 test/kit/kit1.xml delete mode 100644 test/kit/kit2.xml delete mode 100644 test/kit/midimap.xml delete mode 100644 test/kit/ride-multi-channel.wav delete mode 100644 test/kit/ride-single-channel.wav delete mode 100644 test/kit/small_instr.xml delete mode 100644 test/kit/small_kit.xml diff --git a/.gitignore b/.gitignore index 039d66f..0e57b91 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ test/imagecachetest test/semaphoretest test/enginetest test/paintertest +test/drumkitcreatortest test/dgreftest/dgreftest test/dgreftest/*.mid test/dgreftest/*.wav diff --git a/test/Makefile.am b/test/Makefile.am index 1f2419e..457b303 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -9,7 +9,7 @@ include $(top_srcdir)/plugingui/Makefile.am.plugingui TESTS = resource enginetest paintertest resampler configfile audiocache \ audiocachefile audiocacheidmanager audiocacheeventhandler \ memchecker randomtest atomictest syncedsettingstest imagecachetest \ - semaphoretest + semaphoretest drumkitcreatortest if ENABLE_LV2 TESTS += lv2 @@ -18,13 +18,16 @@ endif check_PROGRAMS = $(TESTS) resource_CXXFLAGS = -DOUTPUT=\"resource\" $(CPPUNIT_CFLAGS) \ + -I$(top_srcdir)/src \ -I$(top_srcdir)/hugin -resource_LDFLAGS = $(CPPUNIT_LIBS) +resource_LDFLAGS = $(CPPUNIT_LIBS) $(SNDFILE_LIBS) resource_SOURCES = \ $(top_srcdir)/plugingui/resource.cc \ $(top_srcdir)/plugingui/resource_data.cc \ $(top_srcdir)/hugin/hugin.c \ + $(top_srcdir)/src/random.cc \ test.cc \ + drumkit_creator.cc \ resource_test.cc audiocache_CXXFLAGS = -DOUTPUT=\"audiocache\" $(CPPUNIT_CFLAGS) \ @@ -40,7 +43,9 @@ audiocache_SOURCES = \ $(top_srcdir)/src/mutex.cc \ $(top_srcdir)/src/semaphore.cc \ $(top_srcdir)/src/audiofile.cc \ + $(top_srcdir)/src/random.cc \ test.cc \ + drumkit_creator.cc \ audiocachetest.cc audiocachefile_CXXFLAGS = -DOUTPUT=\"audiocachefile\" $(CPPUNIT_CFLAGS) \ @@ -53,7 +58,9 @@ audiocachefile_SOURCES = \ $(top_srcdir)/src/mutex.cc \ $(top_srcdir)/src/semaphore.cc \ $(top_srcdir)/src/audiofile.cc \ + $(top_srcdir)/src/random.cc \ test.cc \ + drumkit_creator.cc \ audiocachefiletest.cc audiocacheidmanager_CXXFLAGS = -DOUTPUT=\"audiocacheidmanager\" \ @@ -85,11 +92,12 @@ enginetest_CXXFLAGS = -DOUTPUT=\"enginetest\" $(CPPUNIT_CFLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/include \ -I$(top_srcdir)/hugin -DDISABLE_HUGIN $(PTHREAD_CFLAGS) enginetest_CFLAGS = -DDISABLE_HUGIN -enginetest_LDFLAGS = $(CPPUNIT_LIBS) $(DRUMGIZMO_LIBS) $(PTHREAD_LIBS) +enginetest_LDFLAGS = $(CPPUNIT_LIBS) $(DRUMGIZMO_LIBS) $(PTHREAD_LIBS) $(SNDFILE_LIBS) enginetest_SOURCES = \ $(DRUMGIZMO_SOURCES) \ $(top_srcdir)/hugin/hugin.c \ test.cc \ + drumkit_creator.cc \ enginetest.cc paintertest_CXXFLAGS = -DOUTPUT=\"paintertest\" $(CPPUNIT_CFLAGS) \ @@ -119,12 +127,16 @@ resampler_SOURCES = \ resampler.cc lv2_CXXFLAGS = -DOUTPUT=\"lv2\" $(CPPUNIT_CFLAGS) \ + -I$(top_srcdir)/src \ `pkg-config --cflags serd-0` `pkg-config --cflags lilv-0` \ -DLV2_PATH=\"$(libdir)/lv2\" lv2_LDFLAGS = $(CPPUNIT_LIBS) `pkg-config --libs serd-0` \ - `pkg-config --libs lilv-0` -lcrypto + `pkg-config --libs lilv-0` -lcrypto \ + $(SNDFILE_LIBS) lv2_SOURCES = \ + $(top_srcdir)/src/random.cc \ test.cc \ + drumkit_creator.cc \ lv2_test_host.cc \ lv2.cc @@ -145,6 +157,7 @@ memchecker_LDFLAGS = $(CPPUNIT_LIBS) $(DRUMGIZMO_LIBS) $(PTHREAD_LIBS) memchecker_SOURCES = \ $(DRUMGIZMO_SOURCES) \ test.cc \ + drumkit_creator.cc \ memcheckertest.cc randomtest_CXXFLAGS = -DOUTPUT=\"randomtest\" $(CPPUNIT_CFLAGS) \ @@ -168,7 +181,8 @@ syncedsettingstest_LDFLAGS = $(CPPUNIT_LIBS) syncedsettingstest_SOURCES = syncedsettings.cc test.cc EXTRA_DIST = \ - lv2_test_host.h + lv2_test_host.h \ + drumkit_creator.h imagecachetest_CXXFLAGS = -DOUTPUT=\"imagecachetest\" $(CPPUNIT_CFLAGS) \ -I$(top_srcdir)/src -I$(top_srcdir)/plugingui -I$(top_srcdir)/hugin @@ -193,4 +207,15 @@ semaphoretest_SOURCES = \ semaphoretest.cc \ test.cc +drumkitcreatortest_CXXFLAGS = -DOUTPUT=\"drumkitcreatortest\" $(CPPUNIT_CFLAGS) + -I$(top_srcdir)/src \ + -I$(top_srcdir)/hugin -DDISABLE_HUGIN +drumkitcreatortest_CFLAGS = -DDISABLE_HUGIN +drumkitcreatortest_LDFLAGS = $(CPPUNIT_LIBS) $(SNDFILE_LIBS) +drumkitcreatortest_SOURCES = \ + $(top_srcdir)/src/random.cc \ + test.cc \ + drumkit_creator.cc \ + drumkitcreatortest.cc + endif diff --git a/test/audiocachefiletest.cc b/test/audiocachefiletest.cc index b14ae28..7ae2f95 100644 --- a/test/audiocachefiletest.cc +++ b/test/audiocachefiletest.cc @@ -31,6 +31,8 @@ #include #include +#include "drumkit_creator.h" + class TestableAudioCacheFiles : public AudioCacheFiles { @@ -65,8 +67,11 @@ public: void refTest() { + // Create the audio file + auto filename = drumkit_creator::createSingleChannelWav("single_channel.wav"); + + // Conduct tests TestableAudioCacheFiles audiofiles; - std::string filename = "kit/ride-single-channel.wav"; CPPUNIT_ASSERT_EQUAL(-1, audiofiles.getRef(filename)); audiofiles.getFile(filename); @@ -86,7 +91,10 @@ public: { printf("Test buffer size: %d samples\n", (int)buffer_size); - std::string filename = "kit/ride-multi-channel.wav"; + // Create the audio file + auto filename = drumkit_creator::createMultiChannelWav("multi_channel.wav"); + + // Conduct tests AudioFile* ref_file[13]; for(size_t c = 0; c < 13; ++c) { diff --git a/test/audiocachetest.cc b/test/audiocachetest.cc index f67909d..a3d62c9 100644 --- a/test/audiocachetest.cc +++ b/test/audiocachetest.cc @@ -30,6 +30,8 @@ #include #include +#include "drumkit_creator.h" + #define FRAMESIZE 64 class AudioCacheTest @@ -137,41 +139,53 @@ public: void singleChannelNonThreaded() { printf("\nsinglechannel_nonthreaded()\n"); - const char filename[] = "kit/ride-single-channel.wav"; + + auto filename = drumkit_creator::createSingleChannelWav("single_channel.wav"); + + // Conduct test int channel = 0; bool threaded = false; - testHelper(filename, channel, threaded, FRAMESIZE); + testHelper(filename.c_str(), channel, threaded, FRAMESIZE); } void singleChannelThreaded() { printf("\nsinglechannel_threaded()\n"); - const char filename[] = "kit/ride-single-channel.wav"; + + auto filename = drumkit_creator::createSingleChannelWav("single_channel.wav"); + + // Conduct test int channel = 0; bool threaded = true; - testHelper(filename, channel, threaded, FRAMESIZE); + testHelper(filename.c_str(), channel, threaded, FRAMESIZE); } void multiChannelNonThreaded() { printf("\nmultichannel_nonthreaded()\n"); - const char filename[] = "kit/ride-multi-channel.wav"; + + auto filename = drumkit_creator::createMultiChannelWav("multi_channel.wav"); + + // Conduct test int channel = 0; bool threaded = false; - testHelper(filename, channel, threaded, FRAMESIZE); + testHelper(filename.c_str(), channel, threaded, FRAMESIZE); ++channel; - testHelper(filename, channel, threaded, FRAMESIZE); + testHelper(filename.c_str(), channel, threaded, FRAMESIZE); } void multiChannelThreaded() { printf("\nmultichannel_threaded()\n"); - const char filename[] = "kit/ride-multi-channel.wav"; + + auto filename = drumkit_creator::createMultiChannelWav("multi_channel.wav"); + + // Conduct test int channel = 0; bool threaded = true; - testHelper(filename, channel, threaded, FRAMESIZE); + testHelper(filename.c_str(), channel, threaded, FRAMESIZE); ++channel; - testHelper(filename, channel, threaded, FRAMESIZE); + testHelper(filename.c_str(), channel, threaded, FRAMESIZE); } }; diff --git a/test/drumkitcreatortest.cc b/test/drumkitcreatortest.cc new file mode 100644 index 0000000..852f407 --- /dev/null +++ b/test/drumkitcreatortest.cc @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * drumkitcreatortest.cc + * + * Sat Jan 14 15:55:39 CET 2017 + * Copyright 2017 André Nusser + * andre.nusser@googlemail.com + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DrumGizmo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include + +#include "drumkit_creator.h" + +using namespace drumkit_creator; + +class DrumkitcreatorTest + : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE(DrumkitcreatorTest); + CPPUNIT_TEST(testTest); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp() + { + } + + void tearDown() + { + + } + + //! This just creates some drumkit. + void testTest() + { + drumkit_creator::createStdKit("stdkit"); + } +}; + +// Registers the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION(DrumkitcreatorTest); diff --git a/test/enginetest.cc b/test/enginetest.cc index 96d513f..7079bad 100644 --- a/test/enginetest.cc +++ b/test/enginetest.cc @@ -29,6 +29,8 @@ #include #include +#include "drumkit_creator.h" + class AudioOutputEngineDummy : public AudioOutputEngine { @@ -81,28 +83,32 @@ public: DrumGizmo dg(settings, oe, ie); dg.setFrameSize(100); + // Create drumkits + auto kit1_file = drumkit_creator::createStdKit("kit1"); + auto kit2_file = drumkit_creator::createStdKit("kit2"); + // Switch kits emmidiately without giving the loader time to work: for(int i = 0; i < 100; ++i) { - settings.drumkit_file.store("kit/kit1.xml"); - settings.drumkit_file.store("kit/kit2.xml"); + settings.drumkit_file.store(kit1_file); + settings.drumkit_file.store(kit2_file); } // Switch kits with small delay giving the loader time to work a little: for(int i = 0; i < 100; ++i) { - settings.drumkit_file.store("kit/kit1.xml"); + settings.drumkit_file.store(kit1_file); usleep(100); - settings.drumkit_file.store("kit/kit2.xml"); + settings.drumkit_file.store(kit2_file); usleep(100); } // Switch kits with bigger delay giving the loader time to finish for(int i = 0; i < 100; ++i) { - settings.drumkit_file.store("kit/kit1.xml"); + settings.drumkit_file.store(kit1_file); usleep(10000); - settings.drumkit_file.store("kit/kit2.xml"); + settings.drumkit_file.store(kit2_file); usleep(10000); } } diff --git a/test/kit/0000.wav b/test/kit/0000.wav deleted file mode 100644 index 76d3db2..0000000 Binary files a/test/kit/0000.wav and /dev/null differ diff --git a/test/kit/1111.wav b/test/kit/1111.wav deleted file mode 100644 index ae5b743..0000000 Binary files a/test/kit/1111.wav and /dev/null differ diff --git a/test/kit/2222.wav b/test/kit/2222.wav deleted file mode 100644 index aa2f6e6..0000000 Binary files a/test/kit/2222.wav and /dev/null differ diff --git a/test/kit/ffff.wav b/test/kit/ffff.wav deleted file mode 100644 index 76d3db2..0000000 Binary files a/test/kit/ffff.wav and /dev/null differ diff --git a/test/kit/huge_instr.xml b/test/kit/huge_instr.xml deleted file mode 100644 index ca4b6d8..0000000 --- a/test/kit/huge_instr.xml +++ /dev/null @@ -1,755 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/kit/huge_kit.xml b/test/kit/huge_kit.xml deleted file mode 100644 index ca0b3e3..0000000 --- a/test/kit/huge_kit.xml +++ /dev/null @@ -1,770 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/kit/instr1.xml b/test/kit/instr1.xml deleted file mode 100644 index 6b600d5..0000000 --- a/test/kit/instr1.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/test/kit/instr2.xml b/test/kit/instr2.xml deleted file mode 100644 index 76cbc80..0000000 --- a/test/kit/instr2.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/test/kit/kit1.xml b/test/kit/kit1.xml deleted file mode 100644 index dd4c93e..0000000 --- a/test/kit/kit1.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/kit/kit2.xml b/test/kit/kit2.xml deleted file mode 100644 index dd4c93e..0000000 --- a/test/kit/kit2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/kit/midimap.xml b/test/kit/midimap.xml deleted file mode 100644 index 746c745..0000000 --- a/test/kit/midimap.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/test/kit/ride-multi-channel.wav b/test/kit/ride-multi-channel.wav deleted file mode 100644 index 3dec8a9..0000000 Binary files a/test/kit/ride-multi-channel.wav and /dev/null differ diff --git a/test/kit/ride-single-channel.wav b/test/kit/ride-single-channel.wav deleted file mode 100644 index 1760697..0000000 Binary files a/test/kit/ride-single-channel.wav and /dev/null differ diff --git a/test/kit/small_instr.xml b/test/kit/small_instr.xml deleted file mode 100644 index 29181d9..0000000 --- a/test/kit/small_instr.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/test/kit/small_kit.xml b/test/kit/small_kit.xml deleted file mode 100644 index fe0f349..0000000 --- a/test/kit/small_kit.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/lv2.cc b/test/lv2.cc index 45af076..4ad6d94 100644 --- a/test/lv2.cc +++ b/test/lv2.cc @@ -31,6 +31,7 @@ #include #include +#include "drumkit_creator.h" #include "lv2_test_host.h" #define DG_URI "http://drumgizmo.org/lv2" @@ -108,8 +109,10 @@ public: " %s\n" ""; - const char drumkitfile[] = "kit/kit1.xml"; - const char midimapfile[] = "kit/midimap.xml"; + // Create drumkit + auto kit1_file = drumkit_creator::createStdKit("kit1"); + + auto midimapfile = drumkit_creator::createStdMidimap("midimap"); bool enable_velocity_modifier = true; float velocity_modifier_falloff = 0.5; float velocity_modifier_weight = 0.25; @@ -119,8 +122,8 @@ public: char config[sizeof(config_fmt) * 2]; sprintf(config, config_fmt, - drumkitfile, - midimapfile, + kit1_file.c_str(), + midimapfile.c_str(), enable_velocity_modifier?"true":"false", velocity_modifier_falloff, velocity_modifier_weight, @@ -173,8 +176,10 @@ public: " %s\n" ""; - const char drumkitfile[] = "kit/kit1.xml"; - const char midimapfile[] = "kit/midimap.xml"; + // Create drumkit + auto kit1_file = drumkit_creator::createStdKit("kit1"); + + auto midimapfile = drumkit_creator::createStdMidimap("midimap"); bool enable_velocity_modifier = true; float velocity_modifier_falloff = 0.5; float velocity_modifier_weight = 0.25; @@ -184,8 +189,8 @@ public: char config[sizeof(config_fmt) * 2]; sprintf(config, config_fmt, - drumkitfile, - midimapfile, + kit1_file.c_str(), + midimapfile.c_str(), enable_velocity_modifier?"true":"false", velocity_modifier_falloff, velocity_modifier_weight, @@ -250,8 +255,10 @@ public: " %s\n" ""; - const char drumkitfile[] = "kit/kit1.xml"; - const char midimapfile[] = "kit/midimap.xml"; + // Create drumkit + auto kit1_file = drumkit_creator::createStdKit("kit1"); + + auto midimapfile = drumkit_creator::createStdMidimap("midimap"); bool enable_velocity_modifier = true; float velocity_modifier_falloff = 0.5; float velocity_modifier_weight = 0.25; @@ -261,8 +268,8 @@ public: char config[sizeof(config_fmt) * 2]; sprintf(config, config_fmt, - drumkitfile, - midimapfile, + kit1_file.c_str(), + midimapfile.c_str(), enable_velocity_modifier?"true":"false", velocity_modifier_falloff, velocity_modifier_weight, diff --git a/test/memcheckertest.cc b/test/memcheckertest.cc index e685361..125ff6c 100644 --- a/test/memcheckertest.cc +++ b/test/memcheckertest.cc @@ -41,6 +41,8 @@ #include "../src/drumkit.h" #include "../src/drumkitparser.h" +#include "drumkit_creator.h" + class MemCheckerTest : public CppUnit::TestFixture , public MemChecker @@ -56,9 +58,9 @@ private: DrumKit kit; Random random; - const std::string small_kit_path = "kit/small_kit.xml"; - const std::string huge_kit_path = "kit/huge_kit.xml"; - const std::string audiofile = "kit/ride-multi-channel.wav"; + const std::string small_kit_path = drumkit_creator::createSmallKit("small_kit"); + const std::string huge_kit_path = drumkit_creator::createHugeKit("huge_kit"); + const std::string audiofile = drumkit_creator::createMultiChannelWav("multi_channel.wav"); public: void setUp() { diff --git a/test/resource_test.cc b/test/resource_test.cc index 3ebdd6e..c8650a5 100644 --- a/test/resource_test.cc +++ b/test/resource_test.cc @@ -28,6 +28,8 @@ #include "../plugingui/resource.h" +#include "drumkit_creator.h" + class ResourceTester : public GUI::Resource { public: ResourceTester(const std::string& name) @@ -53,7 +55,9 @@ public: void externalReadTest() { - ResourceTester rc("kit/0000.wav"); + auto filename = drumkit_creator::create0000Wav("0000.wav"); + + ResourceTester rc(filename); CPPUNIT_ASSERT(!rc.probeIsInternal()); CPPUNIT_ASSERT(rc.valid()); CPPUNIT_ASSERT_EQUAL((size_t)46, rc.size()); -- cgit v1.2.3