[DEV] rework test with new API

This commit is contained in:
2015-03-13 23:22:17 +01:00
parent 57c4795a1e
commit 0d448bed76
11 changed files with 203 additions and 36 deletions

View File

@@ -48,8 +48,8 @@ namespace river_test_echo_delay {
m_interfaceOut = m_manager->createOutput(48000,
channelMap,
audio::format_int16,
"speaker",
"delayTestOut");
"speaker");
EXPECT_NE(m_interfaceOut, nullptr);
// set callback mode ...
m_interfaceOut->setOutputCallback(std11::bind(&TestClass::onDataNeeded,
this,
@@ -65,8 +65,8 @@ namespace river_test_echo_delay {
m_interfaceIn = m_manager->createInput(48000,
channelMap,
audio::format_int16,
"microphone",
"delayTestIn");
"microphone");
EXPECT_NE(m_interfaceIn, nullptr);
// set callback mode ...
m_interfaceIn->setInputCallback(std11::bind(&TestClass::onDataReceived,
this,
@@ -77,11 +77,11 @@ namespace river_test_echo_delay {
std11::placeholders::_5,
std11::placeholders::_6));
m_interfaceFB = m_manager->createInput(48000,
channelMap,
audio::format_int16,
"feedback",
"delayTestFB");
m_interfaceFB = m_manager->createFeedback(48000,
channelMap,
audio::format_int16,
"speaker");
EXPECT_NE(m_interfaceFB, nullptr);
// set callback mode ...
m_interfaceFB->setInputCallback(std11::bind(&TestClass::onDataReceivedFeedBack,
this,
@@ -363,7 +363,37 @@ namespace river_test_echo_delay {
}
};
static const std::string configurationRiver = "";
static const std::string configurationRiver =
"{\n"
" speaker:{\n"
" io:'output',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
//" name:'hw:0,0',\n"
" timestamp-mode:'trigered',\n"
" },\n"
//" group:'groupSynchro',\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024,\n"
" },\n"
" microphone:{\n"
" io:'input',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
//" name:'hw:0,0',\n"
" timestamp-mode:'trigered',\n"
" },\n"
//" group:'groupSynchro',\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024\n"
" }\n"
"}\n";
TEST(TestTime, testDelay) {
river::initString(configurationRiver);

View File

@@ -11,6 +11,21 @@
#define __class__ "test_format"
namespace river_test_format {
static const std::string configurationRiver =
"{\n"
" speaker:{\n"
" io:'output',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
" },\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024,\n"
" volume-name:'MASTER'\n"
" }\n"
"}\n";
class testOutCallbackType {
private:
std11::shared_ptr<river::Manager> m_manager;
@@ -51,6 +66,7 @@ namespace river_test_format {
_format,
"speaker",
"WriteModeCallbackType");
EXPECT_NE(m_interface, nullptr);
// set callback mode ...
m_interface->setOutputCallback(std11::bind(&testOutCallbackType::onDataNeeded,
this,
@@ -128,7 +144,6 @@ namespace river_test_format {
}
};
static const std::string configurationRiver = "";
class testResampling : public ::testing::TestWithParam<float> {};
TEST_P(testResampling, base) {

View File

@@ -29,8 +29,8 @@ namespace river_test_muxer {
m_interfaceOut = m_manager->createOutput(48000,
channelMap,
audio::format_int16,
"speaker",
"MuxerTestOut");
"speaker");
EXPECT_NE(m_interfaceOut, nullptr);
// set callback mode ...
m_interfaceOut->setOutputCallback(std11::bind(&TestClass::onDataNeeded,
this,
@@ -47,8 +47,8 @@ namespace river_test_muxer {
m_interfaceIn = m_manager->createInput(48000,
std::vector<audio::channel>(),
audio::format_int16,
"microphone-muxed",
"microphone-muxed-local-name");
"microphone-muxed");
EXPECT_NE(m_interfaceIn, nullptr);
// set callback mode ...
m_interfaceIn->setInputCallback(std11::bind(&TestClass::onDataReceived,
this,
@@ -100,7 +100,57 @@ namespace river_test_muxer {
}
};
static const std::string configurationRiver = "";
static const std::string configurationRiver =
"{\n"
" speaker:{\n"
" io:'output',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
" timestamp-mode:'trigered',\n"
" },\n"
" group:'groupSynchro',\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024,\n"
" },\n"
" microphone:{\n"
" io:'input',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
" timestamp-mode:'trigered',\n"
" },\n"
" group:'groupSynchro',\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024\n"
" },\n"
" microphone-muxed:{\n"
" io:'muxer',\n"
" # connect in input mode\n"
" map-on-input-1:{\n"
" # generic virtual definition\n"
" io:'input',\n"
" map-on:'microphone',\n"
" },\n"
" # connect in feedback mode\n"
" map-on-input-2:{\n"
" io:'feedback',\n"
" map-on:'speaker',\n"
" },\n"
" input-2-remap:['rear-left', 'rear-right'],\n"
" #classical format configuration:\n"
" frequency:48000,\n"
" channel-map:[\n"
" 'front-left', 'front-right', 'rear-left', 'rear-right'\n"
" ],\n"
" type:'int16',\n"
" mux-demux-type:'int16',\n"
" }\n"
"}\n";
TEST(TestMuxer, testMuxing) {
river::initString(configurationRiver);

View File

@@ -13,7 +13,7 @@
namespace river_test_playback_callback {
class testOutCallback {
private:
public:
std11::shared_ptr<river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface;
double m_phase;
@@ -28,8 +28,8 @@ namespace river_test_playback_callback {
m_interface = m_manager->createOutput(48000,
channelMap,
audio::format_int16,
_io,
"WriteModeCallback");
_io);
ASSERT_NE(m_interface, nullptr);
// set callback mode ...
m_interface->setOutputCallback(std11::bind(&testOutCallback::onDataNeeded,
this,
@@ -62,6 +62,7 @@ namespace river_test_playback_callback {
}
}
void run() {
ASSERT_NE(m_interface, nullptr);
m_interface->start();
// wait 2 second ...
usleep(2000000);
@@ -69,7 +70,21 @@ namespace river_test_playback_callback {
}
};
static const std::string configurationRiver = "";
static const std::string configurationRiver =
"{\n"
" speaker:{\n"
" io:'output',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
" },\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024,\n"
" volume-name:'MASTER'\n"
" }\n"
"}\n";
TEST(TestALL, testOutputCallBack) {
river::initString(configurationRiver);
@@ -78,6 +93,7 @@ namespace river_test_playback_callback {
APPL_INFO("test output (callback mode)");
std11::shared_ptr<testOutCallback> process = std11::make_shared<testOutCallback>(manager, "speaker");
ASSERT_NE(process, nullptr);
process->run();
process.reset();
usleep(500000);

View File

@@ -11,7 +11,21 @@
#define __class__ "test_playback_write"
namespace river_test_playback_write {
static const std::string configurationRiver = "";
static const std::string configurationRiver =
"{\n"
" speaker:{\n"
" io:'output',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
" },\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024,\n"
" volume-name:'MASTER'\n"
" }\n"
"}\n";
class testOutWrite {
private:
@@ -27,8 +41,8 @@ namespace river_test_playback_write {
m_interface = m_manager->createOutput(48000,
m_channelMap,
audio::format_int16,
"speaker",
"WriteMode");
"speaker");
EXPECT_NE(m_interface, nullptr);
m_interface->setReadwrite();
}
void run() {
@@ -97,8 +111,7 @@ namespace river_test_playback_write {
m_interface = m_manager->createOutput(48000,
channelMap,
audio::format_int16,
"speaker",
"WriteMode+Callback");
"speaker");
m_interface->setReadwrite();
m_interface->setWriteCallback(std11::bind(&testOutWriteCallback::onDataNeeded,
this,
@@ -139,6 +152,7 @@ namespace river_test_playback_write {
};
TEST(TestALL, testOutputWriteWithCallback) {
river::initString(configurationRiver);
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
@@ -147,6 +161,7 @@ namespace river_test_playback_write {
process->run();
process.reset();
usleep(500000);
river::unInit();
}
};

View File

@@ -13,7 +13,20 @@
#define __class__ "test_record_callback"
namespace river_test_record_callback {
static const std::string configurationRiver = "";
static const std::string configurationRiver =
"{\n"
" microphone:{\n"
" io:'input',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
" },\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024\n"
" }\n"
"}\n";
class testInCallback {
private:
@@ -27,8 +40,8 @@ namespace river_test_record_callback {
m_interface = m_manager->createInput(48000,
channelMap,
audio::format_int16,
_input,
"WriteModeCallback");
_input);
EXPECT_NE(m_interface, nullptr);
// set callback mode ...
m_interface->setInputCallback(std11::bind(&testInCallback::onDataReceived,
this,

View File

@@ -11,7 +11,21 @@
#define __class__ "test_volume"
namespace river_test_volume {
static const std::string configurationRiver = "";
static const std::string configurationRiver =
"{\n"
" speaker:{\n"
" io:'output',\n"
" map-on:{\n"
" interface:'auto',\n"
" name:'default',\n"
" },\n"
" frequency:0,\n"
" channel-map:['front-left', 'front-right'],\n"
" type:'auto',\n"
" nb-chunk:1024,\n"
" volume-name:'MASTER'\n"
" }\n"
"}\n";
class testCallbackVolume {
private:
@@ -29,8 +43,8 @@ namespace river_test_volume {
m_interface = m_manager->createOutput(48000,
channelMap,
audio::format_int16,
"speaker",
"WriteModeCallback");
"speaker");
EXPECT_NE(m_interface, nullptr);
// set callback mode ...
m_interface->setOutputCallback(std11::bind(&testCallbackVolume::onDataNeeded,
this,