Skip to content

Commit

Permalink
WIP attempt to mimic MidiControllerJSProxy API for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Jan 7, 2019
1 parent 85a4831 commit 4f0dc16
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/controllers/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class ControllerJSProxy: public QObject {

// The length parameter is here for backwards compatibility for when scripts
// were required to specify it.
Q_INVOKABLE void send(QList<int> data, unsigned int length = 0) {
Q_INVOKABLE virtual void send(QList<int> data, unsigned int length = 0) {
Q_UNUSED(length);
m_pController->send(data, data.length());
}
Expand Down
31 changes: 31 additions & 0 deletions src/test/controller_preset_validation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@
#include "controllers/defs_controllers.h"
#include "test/mixxxtest.h"

class FakeControllerJSProxy : public ControllerJSProxy {
Q_OBJECT
public:
FakeControllerJSProxy();

Q_INVOKABLE void send(QList<int> data, unsigned int length = 0) override {
Q_UNUSED(data);
Q_UNUSED(length);
}

Q_INVOKABLE void sendSysexMsg(QList<int> data, unsigned int length = 0) {
Q_UNUSED(data);
Q_UNUSED(length);
}

Q_INVOKABLE void sendShortMsg(unsigned char status,
unsigned char byte1, unsigned char byte2) {
Q_UNUSED(status);
Q_UNUSED(byte1);
Q_UNUSED(byte2);
}
};

FakeControllerJSProxy::FakeControllerJSProxy()
: ControllerJSProxy(nullptr) {
}

class FakeController : public Controller {
public:
FakeController();
Expand All @@ -23,6 +50,10 @@ class FakeController : public Controller {
return ".test.xml";
}

ControllerJSProxy* jsProxy() override {
return new FakeControllerJSProxy();
}

ControllerPresetPointer getPreset() const override {
if (m_bHidPreset) {
HidControllerPreset* pClone = new HidControllerPreset();
Expand Down

0 comments on commit 4f0dc16

Please sign in to comment.