MediaFactory::MediaFactory()
{
- actionMap[SoundVolume::NAME[SYSTEM_VOLUME]] = SYSTEM_VOLUME;
- actionMap[SoundVolume::NAME[NOTIFICATION_VOLUME]] = NOTIFICATION_VOLUME;
- actionMap[SoundVolume::NAME[RINGTONE_VOLUME]] = RINGTONE_VOLUME;
- actionMap[SoundVolume::NAME[MEDIA_VOLUME]] = MEDIA_VOLUME;
+ actionMap[SoundVolume::NAME[SYSTEM_VOL]] = SYSTEM_VOL;
+ actionMap[SoundVolume::NAME[NOTIFICATION_VOL]] = NOTIFICATION_VOL;
+ actionMap[SoundVolume::NAME[RINGTONE_VOL]] = RINGTONE_VOL;
+ actionMap[SoundVolume::NAME[MEDIA_VOL]] = MEDIA_VOL;
actionMap[MediaPlayer::NAME] = PLAYER;
}
MediaAction *action;
switch (search->second) {
- case SYSTEM_VOLUME:
- action = new SoundVolume(SYSTEM_VOLUME, SOUND_TYPE_SYSTEM);
+ case SYSTEM_VOL:
+ action = new SoundVolume(SYSTEM_VOL, SOUND_TYPE_SYSTEM);
break;
- case NOTIFICATION_VOLUME:
- action = new SoundVolume(NOTIFICATION_VOLUME, SOUND_TYPE_NOTIFICATION);
+ case NOTIFICATION_VOL:
+ action = new SoundVolume(NOTIFICATION_VOL, SOUND_TYPE_NOTIFICATION);
break;
- case RINGTONE_VOLUME:
- action = new SoundVolume(RINGTONE_VOLUME, SOUND_TYPE_RINGTONE);
+ case RINGTONE_VOL:
+ action = new SoundVolume(RINGTONE_VOL, SOUND_TYPE_RINGTONE);
break;
- case MEDIA_VOLUME:
- action = new SoundVolume(MEDIA_VOLUME, SOUND_TYPE_MEDIA);
+ case MEDIA_VOL:
+ action = new SoundVolume(MEDIA_VOL, SOUND_TYPE_MEDIA);
break;
case PLAYER:
action = new MediaPlayer();
void destroyAction(MediaAction *action);
private:
enum actionKey{
- SYSTEM_VOLUME,
- NOTIFICATION_VOLUME,
- RINGTONE_VOLUME,
- MEDIA_VOLUME,
+ SYSTEM_VOL,
+ NOTIFICATION_VOL,
+ RINGTONE_VOL,
+ MEDIA_VOL,
PLAYER
};
// It should align with actionKey in MediaFactory
const std::string SoundVolume::NAME[4] = {
"systemVolume",
- "notificationVolume"
+ "notificationVolume",
"ringtoneVolume",
- "mediaVolume",
+ "mediaVolume"
};
SoundVolume::SoundVolume(int key, sound_type_e soundType)
static gboolean VolumeSetUndoIdler(gpointer data)
{
PluginAction *action;
+ action = nullptr;
result = plugin->set("mediaVolume", 5, &action);
EXPECT_EQ(MODES_ERROR_NONE, result);
plugin->undo(action);
+ action = nullptr;
result = plugin->set("systemVolume", 2, &action);
EXPECT_EQ(MODES_ERROR_NONE, result);
plugin->undo(action);
+ action = nullptr;
result = plugin->set("ringtoneVolume", 9, &action);
EXPECT_EQ(MODES_ERROR_NONE, result);
plugin->undo(action);
+ action = nullptr;
result = plugin->set("notificationVolume", 1, &action);
EXPECT_EQ(MODES_ERROR_NONE, result);
plugin->undo(action);
+ action = nullptr;
result = plugin->set("mediaVolume", -1, &action);
EXPECT_EQ(MODES_ERROR_NONE, result);
plugin->undo(action);
+ action = nullptr;
result = plugin->set("systemVolume", -1, &action);
EXPECT_EQ(MODES_ERROR_NONE, result);
plugin->undo(action);
+ action = nullptr;
result = plugin->set("ringtoneVolume", -1, &action);
EXPECT_EQ(MODES_ERROR_NONE, result);
plugin->undo(action);
+ action = nullptr;
result = plugin->set("notificationVolume", -1, &action);
EXPECT_EQ(MODES_ERROR_NONE, result);
plugin->undo(action);