-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(manage): VoiceGuidance events unit tests
- Loading branch information
1 parent
9466001
commit 45ef90a
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "unit.h" | ||
|
||
class VoiceGuidanceTest : public ::testing::Test | ||
{ | ||
protected: | ||
Firebolt::Error error = Firebolt::Error::None; | ||
}; | ||
|
||
struct EnabledSettings : public Firebolt::VoiceGuidance::IVoiceGuidance::IOnEnabledChangedNotification { | ||
void onEnabledChanged(const bool) override; | ||
}; | ||
|
||
void EnabledSettings::onEnabledChanged(const bool isEnabled) { | ||
std::cout << "onEnabledChanged event fired with isEnabled: " << isEnabled; | ||
} | ||
|
||
TEST_F(VoiceGuidanceTest, subscribeOnEnabledChanged) { | ||
EnabledSettings enabledSettings; | ||
Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().subscribe(enabledSettings, &error); | ||
EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EnabledSettings"; | ||
} | ||
|
||
TEST_F(VoiceGuidanceTest, unsubscribeOnEnabledChanged) { | ||
EnabledSettings enabledSettings; | ||
Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().unsubscribe(enabledSettings, &error); | ||
EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EnabledSettings"; | ||
} | ||
|
||
struct SpeedSettings : public Firebolt::VoiceGuidance::IVoiceGuidance::IOnSpeedChangedNotification { | ||
void onSpeedChanged(const float) override; | ||
}; | ||
|
||
void SpeedSettings::onSpeedChanged(const float speed) { | ||
std::cout << "onSpeedChanged event fired with speed: " << speed; | ||
} | ||
|
||
TEST_F(VoiceGuidanceTest, subscribeOnSpeedChanged) { | ||
SpeedSettings speedSettings; | ||
Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().subscribe(speedSettings, &error); | ||
EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SpeedSettings"; | ||
} | ||
|
||
TEST_F(VoiceGuidanceTest, unsubscribeOnSpeedChanged) { | ||
SpeedSettings speedSettings; | ||
Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().unsubscribe(speedSettings, &error); | ||
EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SpeedSettings"; | ||
} |