From c628fa5304171cd827f56aa475668d99d26ad28a Mon Sep 17 00:00:00 2001 From: Alexandar Donchev Date: Wed, 11 Mar 2015 19:10:54 +0100 Subject: * Sound property lookup enhancement throught caching . Tests for cached sound properties. Signed-off-by: Christian Linke Signed-off-by: Alexandar Donchev > --- .../CAmDatabaseHandlerTest.cpp | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) (limited to 'AudioManagerDaemon/test/AmDatabaseHandlerTest') diff --git a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp index d95a391..85a4c44 100644 --- a/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp +++ b/AudioManagerDaemon/test/AmDatabaseHandlerTest/CAmDatabaseHandlerTest.cpp @@ -1120,6 +1120,13 @@ TEST_F(CAmDatabaseHandlerTest, changeSourceMainSoundProperty) ASSERT_EQ(listIterator->value, property.value); } } + int16_t value; + ASSERT_EQ(E_OK, pDatabaseHandler.getMainSourceSoundPropertyValue(sourceID, property.type, value)); + ASSERT_EQ(value, property.value); + + ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSourceSoundPropertyDB({property.type, 34},sourceID)); + ASSERT_EQ(E_OK, pDatabaseHandler.getMainSourceSoundPropertyValue(sourceID, property.type, value)); + ASSERT_EQ(value, 34); } TEST_F(CAmDatabaseHandlerTest, changeSinkMuteState) @@ -1160,6 +1167,75 @@ TEST_F(CAmDatabaseHandlerTest, changeSinkMainSoundProperty) ASSERT_EQ(listIterator->value, property.value); } } + + int16_t value; + ASSERT_EQ(E_OK, pDatabaseHandler.getMainSinkSoundPropertyValue(sinkID, property.type, value)); + ASSERT_EQ(value, property.value); + + ASSERT_EQ(E_OK, pDatabaseHandler.changeMainSinkSoundPropertyDB({property.type, 34},sinkID)); + ASSERT_EQ(E_OK, pDatabaseHandler.getMainSinkSoundPropertyValue(sinkID, property.type, value)); + ASSERT_EQ(value, 34); +} + +TEST_F(CAmDatabaseHandlerTest, changeSourceSoundProperty) +{ + std::vector listSources; + am_Source_s source; + am_sourceID_t sourceID; + pCF.createSource(source); + am_SoundProperty_s property; + property.type = SP_GENIVI_MID; + property.value = 33; + + ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID)); + + ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceSoundPropertyDB(property,sourceID)); + ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources)); + + std::vector::iterator listIterator = listSources[0].listSoundProperties.begin(); + for (; listIterator < listSources[0].listSoundProperties.end(); ++listIterator) + { + if (listIterator->type == property.type) + ASSERT_EQ(listIterator->value, property.value); + } + int16_t value; + ASSERT_EQ(E_OK, pDatabaseHandler.getSourceSoundPropertyValue(sourceID, property.type, value)); + ASSERT_EQ(value, property.value); + + ASSERT_EQ(E_OK, pDatabaseHandler.changeSourceSoundPropertyDB({property.type, 34},sourceID)); + ASSERT_EQ(E_OK, pDatabaseHandler.getSourceSoundPropertyValue(sourceID, property.type, value)); + ASSERT_EQ(value, 34); +} + +TEST_F(CAmDatabaseHandlerTest, changeSinkSoundProperty) +{ + std::vector listSinks; + am_Sink_s sink; + am_sinkID_t sinkID; + pCF.createSink(sink); + am_SoundProperty_s property; + property.type = SP_GENIVI_MID; + property.value = 33; + + + ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID)); + + ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkSoundPropertyDB(property,sinkID)); + ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks)); + std::vector::iterator listIterator = listSinks[0].listSoundProperties.begin(); + for (; listIterator < listSinks[0].listSoundProperties.end(); ++listIterator) + { + if (listIterator->type == property.type) + ASSERT_EQ(listIterator->value, property.value); + } + + int16_t value; + ASSERT_EQ(E_OK, pDatabaseHandler.getSinkSoundPropertyValue(sinkID, property.type, value)); + ASSERT_EQ(value, property.value); + + ASSERT_EQ(E_OK, pDatabaseHandler.changeSinkSoundPropertyDB({property.type, 34},sinkID)); + ASSERT_EQ(E_OK, pDatabaseHandler.getSinkSoundPropertyValue(sinkID, property.type, value)); + ASSERT_EQ(value, 34); } TEST_F(CAmDatabaseHandlerTest, peekDomain) -- cgit v1.2.1