Skip to content

Commit

Permalink
Fix broken tests when in release config.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisher31 committed Mar 30, 2021
1 parent 1775099 commit 3233c02
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/engine/MidiPipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ int LuaMidiPipe::size (lua_State* L)
return 1;
}

int LuaMidiPipe::clear (lua_State* L)
{
auto* pipe = *(LuaMidiPipe**) lua_touserdata (L, 1);
for (int i = pipe->buffers.size(); --i >= 0;)
(**pipe->buffers.getUnchecked(i)).buffer.clear();
return 0;
}

}

static int midipipe_new (lua_State* L)
Expand All @@ -191,6 +199,7 @@ static const luaL_Reg methods[] = {
{ "get", Element::LuaMidiPipe::get },
{ "resize", Element::LuaMidiPipe::resize },
{ "size", Element::LuaMidiPipe::size },
{ "clear", Element::LuaMidiPipe::clear },
{ nullptr, nullptr }
};

Expand Down
1 change: 1 addition & 0 deletions src/engine/MidiPipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class LuaMidiPipe final
static int get (lua_State* L);
static int resize (lua_State* L);
static int size (lua_State* L);
static int clear (lua_State* L);

private:
lua_State* state = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/nodes/LuaNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ struct LuaNode::Context
local a = AudioBuffer (__ln_validate_nchans, __ln_validate_nframes)
local m = MidiPipe (__ln_validate_nmidi)
for _ = 1,4 do
for i = 0,m:size() - 1 do
local b = m:get(i)
Expand Down
4 changes: 4 additions & 0 deletions tests/scripting/ScriptManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

// FIXME: Local lua paths in release build
#if JUCE_DEBUG

#include "Tests.h"
#include "scripting/ScriptManager.h"
#include "scripting/LuaBindings.h"
Expand All @@ -41,3 +44,4 @@ class ScriptManagerTest : public UnitTestBase
};

static ScriptManagerTest sScriptManagerTest;
#endif

0 comments on commit 3233c02

Please sign in to comment.