From eb10d134f519d16202f5dbff7ac99c2b6db42851 Mon Sep 17 00:00:00 2001 From: Aditya Kasar Date: Tue, 29 Oct 2024 01:26:08 +0530 Subject: [PATCH] fix: Events C++ Unit Tests (#336) * test(manage): Unit test setup * test(manage): Advertising events unit tests * test(manage): AudioDescription events unit tests * test(manage): ClosedCaption events unit tests * test(manage): Device events unit tests * test(manage): Discovery events unit tests * test(manage): HdmiInput events unit tests * test(manage): Localization events unit tests * test(manage): Privacy events unit tests * test(manage): VoiceGuidance events unit tests --------- Co-authored-by: kschrief --- .../manage/src/cpp/sdk/cpptest/CMakeLists.txt | 36 +- src/sdks/manage/src/cpp/sdk/cpptest/Unit.cpp | 10 + .../cpp/sdk/cpptest/unit/advertisingTest.cpp | 34 ++ .../cpptest/unit/audioDescriptionsTest.cpp | 34 ++ .../sdk/cpptest/unit/closedCaptionsTest.cpp | 348 ++++++++++++++++++ .../src/cpp/sdk/cpptest/unit/deviceTest.cpp | 55 +++ .../cpp/sdk/cpptest/unit/discoveryTest.cpp | 47 +++ .../cpp/sdk/cpptest/unit/hdmiInputTest.cpp | 151 ++++++++ .../cpp/sdk/cpptest/unit/localizationTest.cpp | 151 ++++++++ .../src/cpp/sdk/cpptest/unit/privacyTest.cpp | 247 +++++++++++++ .../manage/src/cpp/sdk/cpptest/unit/unit.h | 4 + .../sdk/cpptest/unit/voiceGuidanceTest.cpp | 47 +++ 12 files changed, 1162 insertions(+), 2 deletions(-) create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/Unit.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/advertisingTest.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/audioDescriptionsTest.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/closedCaptionsTest.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/deviceTest.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/discoveryTest.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/hdmiInputTest.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/localizationTest.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/privacyTest.cpp create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/unit.h create mode 100644 src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/CMakeLists.txt b/src/sdks/manage/src/cpp/sdk/cpptest/CMakeLists.txt index b5053ba20..9ca7094cc 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/CMakeLists.txt +++ b/src/sdks/manage/src/cpp/sdk/cpptest/CMakeLists.txt @@ -39,8 +39,6 @@ endif () find_package(WPEFramework CONFIG REQUIRED) find_package(${NAMESPACE}Core CONFIG REQUIRED) -find_package(Firebolt CONFIG REQUIRED) -find_package(${FIREBOLT_NAMESPACE}SDK CONFIG REQUIRED) set(TESTAPP TestFireboltManage) @@ -52,6 +50,8 @@ target_link_libraries(${TESTAPP} PRIVATE ${NAMESPACE}Core::${NAMESPACE}Core ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK + nlohmann_json_schema_validator + gtest_main ) target_include_directories(${TESTAPP} @@ -59,6 +59,7 @@ target_include_directories(${TESTAPP} $ $ $ + $ ) set_target_properties(${TESTAPP} PROPERTIES @@ -73,3 +74,34 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${TESTAPP} ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin ) + +if(ENABLE_UNIT_TESTS) + set(UNIT_TESTS_APP FireboltManageUnitTests) + + message("Setup ${UNIT_TESTS_APP}") + + file(GLOB UNIT_TESTS "unit/*") + + add_executable(${UNIT_TESTS_APP} + ManageSDKTest.cpp + Unit.cpp + ${UNIT_TESTS} + ) + + link_directories(${CMAKE_SOURCE_DIR}/../../Thunder/install/usr/lib/) + target_link_libraries(${UNIT_TESTS_APP} + PRIVATE + ${NAMESPACE}Core::${NAMESPACE}Core + ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK + nlohmann_json_schema_validator + gtest_main + ) + + target_include_directories(${UNIT_TESTS_APP} + PRIVATE + $ + ) + + include(GoogleTest) + gtest_discover_tests(${UNIT_TESTS_APP}) +endif() \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/Unit.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/Unit.cpp new file mode 100644 index 000000000..c3485c0f6 --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/Unit.cpp @@ -0,0 +1,10 @@ +#include "gtest/gtest.h" +#include "ManageSDKTest.h" + +int main(int argc, char **argv) +{ + std::string url = "ws://localhost:9998"; + ManageSDKTest::CreateFireboltInstance(url); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/advertisingTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/advertisingTest.cpp new file mode 100644 index 000000000..6c2dda5ff --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/advertisingTest.cpp @@ -0,0 +1,34 @@ +#include "unit.h" + +class AdvertisingTest : public ::testing::Test +{ +protected: + Firebolt::Error error = Firebolt::Error::None; +}; + + +struct SkipRestrictionChanged : public Firebolt::Advertising::IAdvertising::IOnSkipRestrictionChangedNotification +{ + void onSkipRestrictionChanged( const Firebolt::Advertising::SkipRestriction& ) override; +}; + +Firebolt::Advertising::SkipRestriction newSkipRestriction; +void SkipRestrictionChanged::onSkipRestrictionChanged(const Firebolt::Advertising::SkipRestriction& skipRestriction) +{ + std::cout << "onSkipRestrictionChanged event fired"; +} + + +TEST_F(AdvertisingTest, subscribeOnSkipRestrictionChanged) +{ + SkipRestrictionChanged skipRestrictionChanged; + Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().subscribe(skipRestrictionChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SkipRestrictionChanged"; +} + +TEST_F(AdvertisingTest, unsubscribeOnSkipRestrictionChanged) +{ + SkipRestrictionChanged skipRestrictionChanged; + Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().unsubscribe(skipRestrictionChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SkipRestrictionChanged"; +} \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/audioDescriptionsTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/audioDescriptionsTest.cpp new file mode 100644 index 000000000..743a56b58 --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/audioDescriptionsTest.cpp @@ -0,0 +1,34 @@ +#include "unit.h" + +class AudioDescriptionsTest : public ::testing::Test +{ +protected: + Firebolt::Error error = Firebolt::Error::None; +}; + + +struct EnabledChanged : public Firebolt::AudioDescriptions::IAudioDescriptions::IOnEnabledChangedNotification +{ + void onEnabledChanged( const bool ) override; +}; + + +void EnabledChanged::onEnabledChanged(const bool) +{ + std::cout << "onAudioDescriptionEnabledChanged event fired"; +} + + +TEST_F(AudioDescriptionsTest, subscribeonEnabledChanged) +{ + EnabledChanged enabledChanged; + Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().subscribe(enabledChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EnabledChanged"; +} + +TEST_F(AudioDescriptionsTest, unsubscribeonEnabledChanged) +{ + EnabledChanged enabledChanged; + Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().unsubscribe(enabledChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EnabledChanged"; +} \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/closedCaptionsTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/closedCaptionsTest.cpp new file mode 100644 index 000000000..4d35aa587 --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/closedCaptionsTest.cpp @@ -0,0 +1,348 @@ +#include "unit.h" + +class ClosedCaptionsTest : public ::testing::Test +{ +protected: + Firebolt::Error error = Firebolt::Error::None; +}; + +struct BackgroundColorChanged : public Firebolt::ClosedCaptions::IClosedCaptions::IOnBackgroundColorChangedNotification +{ + void onBackgroundColorChanged(const std::string &) override; +}; + +void BackgroundColorChanged::onBackgroundColorChanged(const std::string &) +{ + std::cout << "onBackgroundColorChanged event fired"; +} + +TEST_F(ClosedCaptionsTest, subscribeOnBackgroundColorChanged) +{ + BackgroundColorChanged backgroundColorChanged; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(backgroundColorChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to BackgroundColorChanged"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnBackgroundColorChanged) +{ + BackgroundColorChanged backgroundColorChanged; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(backgroundColorChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to BackgroundColorChanged"; +} + +struct BackgroundOpacityChanged : public Firebolt::ClosedCaptions::IClosedCaptions::IOnBackgroundOpacityChangedNotification +{ + void onBackgroundOpacityChanged(const float) override; +}; + +void BackgroundOpacityChanged::onBackgroundOpacityChanged(const float) +{ + std::cout << "onBackgroundOpacityChanged event fired"; +} + +TEST_F(ClosedCaptionsTest, subscribeOnBackgroundOpacityChanged) +{ + BackgroundOpacityChanged backgroundOpacityChanged; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(backgroundOpacityChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to BackgroundOpacityChanged"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnBackgroundOpacityChanged) +{ + BackgroundOpacityChanged backgroundOpacityChanged; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(backgroundOpacityChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to BackgroundOpacityChanged"; +} + +struct ClosedCaptionEnabledChanged : public Firebolt::ClosedCaptions::IClosedCaptions::IOnEnabledChangedNotification +{ + void onEnabledChanged(const bool) override; +}; + +void ClosedCaptionEnabledChanged::onEnabledChanged(const bool) +{ + std::cout << "onEnabledChanged event fired"; +} + +TEST_F(ClosedCaptionsTest, subscribeOnEnabledChanged) +{ + ClosedCaptionEnabledChanged ccEnabledChanged; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(ccEnabledChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EnabledChanged"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnEnabledChanged) +{ + ClosedCaptionEnabledChanged ccEnabledChanged; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(ccEnabledChanged, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EnabledChanged"; +} + +struct FontColorSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontColorChangedNotification +{ + void onFontColorChanged(const std::string &) override; +}; + +void FontColorSettings::onFontColorChanged(const std::string &color) +{ + std::cout << "onFontColorChanged event fired with color: " << color; +} + +TEST_F(ClosedCaptionsTest, subscribeOnFontColorChanged) +{ + FontColorSettings fontColorSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontColorSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontColorSettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnFontColorChanged) +{ + FontColorSettings fontColorSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontColorSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontColorSettings"; +} + +struct FontEdgeSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontEdgeChangedNotification +{ + void onFontEdgeChanged(const Firebolt::Accessibility::FontEdge &) override; +}; + +void FontEdgeSettings::onFontEdgeChanged(const Firebolt::Accessibility::FontEdge &edge) +{ + std::cout << "onFontEdgeChanged event fired"; +} + +TEST_F(ClosedCaptionsTest, subscribeOnFontEdgeChanged) +{ + FontEdgeSettings fontEdgeSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontEdgeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontEdgeSettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnFontEdgeChanged) +{ + FontEdgeSettings fontEdgeSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontEdgeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontEdgeSettings"; +} + +struct FontEdgeColorSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontEdgeColorChangedNotification +{ + void onFontEdgeColorChanged(const std::string &) override; +}; + +void FontEdgeColorSettings::onFontEdgeColorChanged(const std::string &color) +{ + std::cout << "onFontEdgeColorChanged event fired with color: " << color; +} + +TEST_F(ClosedCaptionsTest, subscribeOnFontEdgeColorChanged) +{ + FontEdgeColorSettings fontEdgeColorSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontEdgeColorSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontEdgeColorSettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnFontEdgeColorChanged) +{ + FontEdgeColorSettings fontEdgeColorSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontEdgeColorSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontEdgeColorSettings"; +} + +struct FontFamilySettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontFamilyChangedNotification +{ + void onFontFamilyChanged(const Firebolt::Accessibility::FontFamily &) override; +}; + +void FontFamilySettings::onFontFamilyChanged(const Firebolt::Accessibility::FontFamily &family) +{ + std::cout << "onFontFamilyChanged event fired"; +} + +TEST_F(ClosedCaptionsTest, subscribeOnFontFamilyChanged) +{ + FontFamilySettings fontFamilySettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontFamilySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontFamilySettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnFontFamilyChanged) +{ + FontFamilySettings fontFamilySettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontFamilySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontFamilySettings"; +} + +struct FontOpacitySettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontOpacityChangedNotification +{ + void onFontOpacityChanged(const float) override; +}; + +void FontOpacitySettings::onFontOpacityChanged(const float opacity) +{ + std::cout << "onFontOpacityChanged event fired with opacity: " << opacity; +} + +TEST_F(ClosedCaptionsTest, subscribeOnFontOpacityChanged) +{ + FontOpacitySettings fontOpacitySettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontOpacitySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontOpacitySettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnFontOpacityChanged) +{ + FontOpacitySettings fontOpacitySettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontOpacitySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontOpacitySettings"; +} + +struct FontSizeSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontSizeChangedNotification +{ + void onFontSizeChanged(const float) override; +}; + +void FontSizeSettings::onFontSizeChanged(const float size) +{ + std::cout << "onFontSizeChanged event fired with size: " << size; +} + +TEST_F(ClosedCaptionsTest, subscribeOnFontSizeChanged) +{ + FontSizeSettings fontSizeSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontSizeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontSizeSettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnFontSizeChanged) +{ + FontSizeSettings fontSizeSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontSizeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontSizeSettings"; +} + +struct PreferredLanguagesSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnPreferredLanguagesChangedNotification +{ + void onPreferredLanguagesChanged(const std::vector &) override; +}; + +void PreferredLanguagesSettings::onPreferredLanguagesChanged(const std::vector &languages) +{ + std::cout << "onPreferredLanguagesChanged event fired with languages: "; + for (const auto &lang : languages) + { + std::cout << lang << " "; + } + std::cout << std::endl; +} + +TEST_F(ClosedCaptionsTest, subscribeOnPreferredLanguagesChanged) +{ + PreferredLanguagesSettings preferredLanguagesSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(preferredLanguagesSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to PreferredLanguagesSettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnPreferredLanguagesChanged) +{ + PreferredLanguagesSettings preferredLanguagesSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(preferredLanguagesSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to PreferredLanguagesSettings"; +} + +struct TextAlignSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnTextAlignChangedNotification +{ + void onTextAlignChanged(const std::string &) override; +}; + +void TextAlignSettings::onTextAlignChanged(const std::string &alignment) +{ + std::cout << "onTextAlignChanged event fired with alignment: " << alignment; +} + +TEST_F(ClosedCaptionsTest, subscribeOnTextAlignChanged) +{ + TextAlignSettings textAlignSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(textAlignSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to TextAlignSettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnTextAlignChanged) +{ + TextAlignSettings textAlignSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(textAlignSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to TextAlignSettings"; +} + +struct TextAlignVerticalSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnTextAlignVerticalChangedNotification +{ + void onTextAlignVerticalChanged(const std::string &) override; +}; + +void TextAlignVerticalSettings::onTextAlignVerticalChanged(const std::string &alignment) +{ + std::cout << "onTextAlignVerticalChanged event fired with alignment: " << alignment; +} + +TEST_F(ClosedCaptionsTest, subscribeOnTextAlignVerticalChanged) +{ + TextAlignVerticalSettings textAlignVerticalSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(textAlignVerticalSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to TextAlignVerticalSettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnTextAlignVerticalChanged) +{ + TextAlignVerticalSettings textAlignVerticalSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(textAlignVerticalSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to TextAlignVerticalSettings"; +} + +struct WindowColorSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnWindowColorChangedNotification +{ + void onWindowColorChanged(const std::string &) override; +}; + +void WindowColorSettings::onWindowColorChanged(const std::string &color) +{ + std::cout << "onWindowColorChanged event fired with color: " << color; +} + +TEST_F(ClosedCaptionsTest, subscribeOnWindowColorChanged) +{ + WindowColorSettings windowColorSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(windowColorSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to WindowColorSettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnWindowColorChanged) +{ + WindowColorSettings windowColorSettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(windowColorSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to WindowColorSettings"; +} + +struct WindowOpacitySettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnWindowOpacityChangedNotification +{ + void onWindowOpacityChanged(const float) override; +}; + +void WindowOpacitySettings::onWindowOpacityChanged(const float opacity) +{ + std::cout << "onWindowOpacityChanged event fired with opacity: " << opacity; +} + +TEST_F(ClosedCaptionsTest, subscribeOnWindowOpacityChanged) +{ + WindowOpacitySettings windowOpacitySettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(windowOpacitySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to WindowOpacitySettings"; +} + +TEST_F(ClosedCaptionsTest, unsubscribeOnWindowOpacityChanged) +{ + WindowOpacitySettings windowOpacitySettings; + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(windowOpacitySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to WindowOpacitySettings"; +} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/deviceTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/deviceTest.cpp new file mode 100644 index 000000000..cbfe68250 --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/deviceTest.cpp @@ -0,0 +1,55 @@ +#include "unit.h" + +class DeviceTest : public ::testing::Test +{ +protected: + Firebolt::Error error = Firebolt::Error::None; +}; + +struct DeviceNameSettings : public Firebolt::Device::IDevice::IOnDeviceNameChangedNotification +{ + void onDeviceNameChanged(const std::string &) override; +}; + +void DeviceNameSettings::onDeviceNameChanged(const std::string &name) +{ + std::cout << "onDeviceNameChanged event fired"; +} + +TEST_F(DeviceTest, subscribeOnDeviceNameChanged) +{ + DeviceNameSettings deviceNameSettings; + Firebolt::IFireboltAccessor::Instance().DeviceInterface().subscribe(deviceNameSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to DeviceNameSettings"; +} + +TEST_F(DeviceTest, unsubscribeOnDeviceNameChanged) +{ + DeviceNameSettings deviceNameSettings; + Firebolt::IFireboltAccessor::Instance().DeviceInterface().unsubscribe(deviceNameSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to DeviceNameSettings"; +} + +struct NameSettings : public Firebolt::Device::IDevice::IOnNameChangedNotification +{ + void onNameChanged(const std::string &) override; +}; + +void NameSettings::onNameChanged(const std::string &name) +{ + std::cout << "onNameChanged event fired"; +} + +TEST_F(DeviceTest, subscribeOnNameChanged) +{ + NameSettings nameSettings; + Firebolt::IFireboltAccessor::Instance().DeviceInterface().subscribe(nameSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to NameSettings"; +} + +TEST_F(DeviceTest, unsubscribeOnNameChanged) +{ + NameSettings nameSettings; + Firebolt::IFireboltAccessor::Instance().DeviceInterface().unsubscribe(nameSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to NameSettings"; +} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/discoveryTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/discoveryTest.cpp new file mode 100644 index 000000000..1d5e02b83 --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/discoveryTest.cpp @@ -0,0 +1,47 @@ +#include "unit.h" + +class DiscoveryTest : public ::testing::Test +{ +protected: + Firebolt::Error error = Firebolt::Error::None; +}; + +struct SignInSettings : public Firebolt::Discovery::IDiscovery::IOnSignInNotification { + void onSignIn(const Firebolt::Discovery::Event&) override; +}; + +void SignInSettings::onSignIn(const Firebolt::Discovery::Event& event) { + std::cout << "onSignIn event fired"; +} + +TEST_F(DiscoveryTest, subscribeOnSignIn) { + SignInSettings signInSettings; + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().subscribe(signInSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SignInSettings"; +} + +TEST_F(DiscoveryTest, unsubscribeOnSignIn) { + SignInSettings signInSettings; + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().unsubscribe(signInSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SignInSettings"; +} + +struct SignOutSettings : public Firebolt::Discovery::IDiscovery::IOnSignOutNotification { + void onSignOut(const Firebolt::Discovery::Event&) override; +}; + +void SignOutSettings::onSignOut(const Firebolt::Discovery::Event& event) { + std::cout << "onSignOut event fired"; +} + +TEST_F(DiscoveryTest, subscribeOnSignOut) { + SignOutSettings signOutSettings; + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().subscribe(signOutSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SignOutSettings"; +} + +TEST_F(DiscoveryTest, unsubscribeOnSignOut) { + SignOutSettings signOutSettings; + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().unsubscribe(signOutSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SignOutSettings"; +} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/hdmiInputTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/hdmiInputTest.cpp new file mode 100644 index 000000000..ef886214a --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/hdmiInputTest.cpp @@ -0,0 +1,151 @@ +#include "unit.h" + +class HdmiInputTest : public ::testing::Test +{ +protected: + Firebolt::Error error = Firebolt::Error::None; +}; + +struct AutoLowLatencyModeCapableSettings : public Firebolt::HDMIInput::IHDMIInput::IOnAutoLowLatencyModeCapableChangedNotification +{ + void onAutoLowLatencyModeCapableChanged(const Firebolt::HDMIInput::AutoLowLatencyModeCapableChangedInfo &) override; +}; + +void AutoLowLatencyModeCapableSettings::onAutoLowLatencyModeCapableChanged(const Firebolt::HDMIInput::AutoLowLatencyModeCapableChangedInfo &info) +{ + std::cout << "onAutoLowLatencyModeCapableChanged event fired"; +} + +TEST_F(HdmiInputTest, subscribeOnAutoLowLatencyModeCapableChanged) +{ + AutoLowLatencyModeCapableSettings autoLowLatencySettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(autoLowLatencySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AutoLowLatencyModeCapableSettings"; +} + +TEST_F(HdmiInputTest, unsubscribeOnAutoLowLatencyModeCapableChanged) +{ + AutoLowLatencyModeCapableSettings autoLowLatencySettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(autoLowLatencySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AutoLowLatencyModeCapableSettings"; +} + +struct AutoLowLatencyModeSignalSettings : public Firebolt::HDMIInput::IHDMIInput::IOnAutoLowLatencyModeSignalChangedNotification +{ + void onAutoLowLatencyModeSignalChanged(const Firebolt::HDMIInput::AutoLowLatencyModeSignalChangedInfo &) override; +}; + +void AutoLowLatencyModeSignalSettings::onAutoLowLatencyModeSignalChanged(const Firebolt::HDMIInput::AutoLowLatencyModeSignalChangedInfo &info) +{ + std::cout << "onAutoLowLatencyModeSignalChanged event fired"; +} + +TEST_F(HdmiInputTest, subscribeOnAutoLowLatencyModeSignalChanged) +{ + AutoLowLatencyModeSignalSettings autoLowLatencySignalSettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(autoLowLatencySignalSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AutoLowLatencyModeSignalSettings"; +} + +TEST_F(HdmiInputTest, unsubscribeOnAutoLowLatencyModeSignalChanged) +{ + AutoLowLatencyModeSignalSettings autoLowLatencySignalSettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(autoLowLatencySignalSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AutoLowLatencyModeSignalSettings"; +} + +struct ConnectionSettings : public Firebolt::HDMIInput::IHDMIInput::IOnConnectionChangedNotification +{ + void onConnectionChanged(const Firebolt::HDMIInput::ConnectionChangedInfo &) override; +}; + +void ConnectionSettings::onConnectionChanged(const Firebolt::HDMIInput::ConnectionChangedInfo &info) +{ + std::cout << "onConnectionChanged event fired"; +} + +TEST_F(HdmiInputTest, subscribeOnConnectionChanged) +{ + ConnectionSettings connectionSettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(connectionSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to ConnectionSettings"; +} + +TEST_F(HdmiInputTest, unsubscribeOnConnectionChanged) +{ + ConnectionSettings connectionSettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(connectionSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to ConnectionSettings"; +} + +struct EdidVersionSettings : public Firebolt::HDMIInput::IHDMIInput::IOnEdidVersionChangedNotification +{ + void onEdidVersionChanged(const Firebolt::HDMIInput::EDIDVersion &) override; +}; + +void EdidVersionSettings::onEdidVersionChanged(const Firebolt::HDMIInput::EDIDVersion &version) +{ + std::cout << "onEdidVersionChanged event fired"; +} + +TEST_F(HdmiInputTest, subscribeOnEdidVersionChanged) +{ + EdidVersionSettings edidVersionSettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe("port_name", edidVersionSettings, &error); // Replace "port_name" with actual port name + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EdidVersionSettings"; +} + +TEST_F(HdmiInputTest, unsubscribeOnEdidVersionChanged) +{ + EdidVersionSettings edidVersionSettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(edidVersionSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EdidVersionSettings"; +} + +struct LowLatencyModeSettings : public Firebolt::HDMIInput::IHDMIInput::IOnLowLatencyModeChangedNotification +{ + void onLowLatencyModeChanged(const bool) override; +}; + +void LowLatencyModeSettings::onLowLatencyModeChanged(const bool mode) +{ + std::cout << "onLowLatencyModeChanged event fired"; +} + +TEST_F(HdmiInputTest, subscribeOnLowLatencyModeChanged) +{ + LowLatencyModeSettings lowLatencySettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(lowLatencySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to LowLatencyModeSettings"; +} + +TEST_F(HdmiInputTest, unsubscribeOnLowLatencyModeChanged) +{ + LowLatencyModeSettings lowLatencySettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(lowLatencySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to LowLatencyModeSettings"; +} + +struct SignalSettings : public Firebolt::HDMIInput::IHDMIInput::IOnSignalChangedNotification +{ + void onSignalChanged(const Firebolt::HDMIInput::SignalChangedInfo &) override; +}; + +void SignalSettings::onSignalChanged(const Firebolt::HDMIInput::SignalChangedInfo &info) +{ + std::cout << "onSignalChanged event fired"; +} + +TEST_F(HdmiInputTest, subscribeOnSignalChanged) +{ + SignalSettings signalSettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(signalSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SignalSettings"; +} + +TEST_F(HdmiInputTest, unsubscribeOnSignalChanged) +{ + SignalSettings signalSettings; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(signalSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SignalSettings"; +} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/localizationTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/localizationTest.cpp new file mode 100644 index 000000000..003bddf12 --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/localizationTest.cpp @@ -0,0 +1,151 @@ +#include "unit.h" + +class LocalizationTest : public ::testing::Test +{ +protected: + Firebolt::Error error = Firebolt::Error::None; +}; + +struct CountryCodeSettings : public Firebolt::Localization::ILocalization::IOnCountryCodeChangedNotification { + void onCountryCodeChanged(const std::string &) override; +}; + +void CountryCodeSettings::onCountryCodeChanged(const std::string &code) { + std::cout << "onCountryCodeChanged event fired"; +} + +TEST_F(LocalizationTest, subscribeOnCountryCodeChanged) { + CountryCodeSettings countryCodeSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(countryCodeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to CountryCodeSettings"; +} + +TEST_F(LocalizationTest, unsubscribeOnCountryCodeChanged) { + CountryCodeSettings countryCodeSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(countryCodeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to CountryCodeSettings"; +} + +struct LanguageSettings : public Firebolt::Localization::ILocalization::IOnLanguageChangedNotification { + void onLanguageChanged(const std::string &) override; +}; + +void LanguageSettings::onLanguageChanged(const std::string &language) { + std::cout << "onLanguageChanged event fired with language: " << language; +} + +TEST_F(LocalizationTest, subscribeOnLanguageChanged) { + LanguageSettings languageSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(languageSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to LanguageSettings"; +} + +TEST_F(LocalizationTest, unsubscribeOnLanguageChanged) { + LanguageSettings languageSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(languageSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to LanguageSettings"; +} + +struct LocaleSettings : public Firebolt::Localization::ILocalization::IOnLocaleChangedNotification { + void onLocaleChanged(const std::string &) override; +}; + +void LocaleSettings::onLocaleChanged(const std::string &locale) { + std::cout << "onLocaleChanged event fired with locale: " << locale; +} + +TEST_F(LocalizationTest, subscribeOnLocaleChanged) { + LocaleSettings localeSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(localeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to LocaleSettings"; +} + +TEST_F(LocalizationTest, unsubscribeOnLocaleChanged) { + LocaleSettings localeSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(localeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to LocaleSettings"; +} + +struct LocalitySettings : public Firebolt::Localization::ILocalization::IOnLocalityChangedNotification { + void onLocalityChanged(const std::string &) override; +}; + +void LocalitySettings::onLocalityChanged(const std::string &locality) { + std::cout << "onLocalityChanged event fired with locality: " << locality; +} + +TEST_F(LocalizationTest, subscribeOnLocalityChanged) { + LocalitySettings localitySettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(localitySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to LocalitySettings"; +} + +TEST_F(LocalizationTest, unsubscribeOnLocalityChanged) { + LocalitySettings localitySettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(localitySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to LocalitySettings"; +} + +struct PostalCodeSettings : public Firebolt::Localization::ILocalization::IOnPostalCodeChangedNotification { + void onPostalCodeChanged(const std::string &) override; +}; + +void PostalCodeSettings::onPostalCodeChanged(const std::string &postalCode) { + std::cout << "onPostalCodeChanged event fired with postal code: " << postalCode; +} + +TEST_F(LocalizationTest, subscribeOnPostalCodeChanged) { + PostalCodeSettings postalCodeSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(postalCodeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to PostalCodeSettings"; +} + +TEST_F(LocalizationTest, unsubscribeOnPostalCodeChanged) { + PostalCodeSettings postalCodeSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(postalCodeSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to PostalCodeSettings"; +} + +struct PreferredAudioLanguagesSettings : public Firebolt::Localization::ILocalization::IOnPreferredAudioLanguagesChangedNotification { + void onPreferredAudioLanguagesChanged(const std::vector&) override; +}; + +void PreferredAudioLanguagesSettings::onPreferredAudioLanguagesChanged(const std::vector& languages) { + std::cout << "onPreferredAudioLanguagesChanged event fired with languages: "; + for(const auto& lang : languages) { + std::cout << lang << " "; + } + std::cout << std::endl; +} + +TEST_F(LocalizationTest, subscribeOnPreferredAudioLanguagesChanged) { + PreferredAudioLanguagesSettings preferredAudioLanguagesSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(preferredAudioLanguagesSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to PreferredAudioLanguagesSettings"; +} + +TEST_F(LocalizationTest, unsubscribeOnPreferredAudioLanguagesChanged) { + PreferredAudioLanguagesSettings preferredAudioLanguagesSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(preferredAudioLanguagesSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to PreferredAudioLanguagesSettings"; +} + +struct TimeZoneSettings : public Firebolt::Localization::ILocalization::IOnTimeZoneChangedNotification { + void onTimeZoneChanged(const std::string &) override; +}; + +void TimeZoneSettings::onTimeZoneChanged(const std::string &timeZone) { + std::cout << "onTimeZoneChanged event fired with time zone: " << timeZone; +} + +TEST_F(LocalizationTest, subscribeOnTimeZoneChanged) { + TimeZoneSettings timeZoneSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(timeZoneSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to TimeZoneSettings"; +} + +TEST_F(LocalizationTest, unsubscribeOnTimeZoneChanged) { + TimeZoneSettings timeZoneSettings; + Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(timeZoneSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to TimeZoneSettings"; +} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/privacyTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/privacyTest.cpp new file mode 100644 index 000000000..d85c4c78d --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/privacyTest.cpp @@ -0,0 +1,247 @@ +#include "unit.h" + +class PrivacyTest : public ::testing::Test +{ +protected: + Firebolt::Error error = Firebolt::Error::None; +}; + +struct AllowACRCollectionSettings : public Firebolt::Privacy::IPrivacy::IOnAllowACRCollectionChangedNotification { + void onAllowACRCollectionChanged(const bool) override; +}; + +void AllowACRCollectionSettings::onAllowACRCollectionChanged(const bool isAllowed) { + std::cout << "onAllowACRCollectionChanged event fired with isAllowed: " << isAllowed; +} + +TEST_F(PrivacyTest, subscribeOnAllowACRCollectionChanged) { + AllowACRCollectionSettings allowACRCollectionSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowACRCollectionSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowACRCollectionSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowACRCollectionChanged) { + AllowACRCollectionSettings allowACRCollectionSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowACRCollectionSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowACRCollectionSettings"; +} + +struct AllowAppContentAdTargetingSettings : public Firebolt::Privacy::IPrivacy::IOnAllowAppContentAdTargetingChangedNotification { + void onAllowAppContentAdTargetingChanged(const bool) override; +}; + +void AllowAppContentAdTargetingSettings::onAllowAppContentAdTargetingChanged(const bool isAllowed) { + std::cout << "onAllowAppContentAdTargetingChanged event fired"; +} + +TEST_F(PrivacyTest, subscribeOnAllowAppContentAdTargetingChanged) { + AllowAppContentAdTargetingSettings allowAppContentAdTargetingSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowAppContentAdTargetingSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowAppContentAdTargetingSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowAppContentAdTargetingChanged) { + AllowAppContentAdTargetingSettings allowAppContentAdTargetingSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowAppContentAdTargetingSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowAppContentAdTargetingSettings"; +} + +struct AllowCameraAnalyticsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowCameraAnalyticsChangedNotification { + void onAllowCameraAnalyticsChanged(const bool) override; +}; + +void AllowCameraAnalyticsSettings::onAllowCameraAnalyticsChanged(const bool isAllowed) { + std::cout << "onAllowCameraAnalyticsChanged event fired"; +} + +TEST_F(PrivacyTest, subscribeOnAllowCameraAnalyticsChanged) { + AllowCameraAnalyticsSettings allowCameraAnalyticsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowCameraAnalyticsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowCameraAnalyticsSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowCameraAnalyticsChanged) { + AllowCameraAnalyticsSettings allowCameraAnalyticsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowCameraAnalyticsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowCameraAnalyticsSettings"; +} + +struct AllowPersonalizationSettings : public Firebolt::Privacy::IPrivacy::IOnAllowPersonalizationChangedNotification { + void onAllowPersonalizationChanged(const bool) override; +}; + +void AllowPersonalizationSettings::onAllowPersonalizationChanged(const bool isAllowed) { + std::cout << "onAllowPersonalizationChanged event fired"; +} + +TEST_F(PrivacyTest, subscribeOnAllowPersonalizationChanged) { + AllowPersonalizationSettings allowPersonalizationSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowPersonalizationSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowPersonalizationSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowPersonalizationChanged) { + AllowPersonalizationSettings allowPersonalizationSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowPersonalizationSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowPersonalizationSettings"; +} + +struct AllowPrimaryBrowseAdTargetingSettings : public Firebolt::Privacy::IPrivacy::IOnAllowPrimaryBrowseAdTargetingChangedNotification { + void onAllowPrimaryBrowseAdTargetingChanged(const bool) override; +}; + +void AllowPrimaryBrowseAdTargetingSettings::onAllowPrimaryBrowseAdTargetingChanged(const bool isAllowed) { + std::cout << "onAllowPrimaryBrowseAdTargetingChanged event fired"; +} + +TEST_F(PrivacyTest, subscribeOnAllowPrimaryBrowseAdTargetingChanged) { + AllowPrimaryBrowseAdTargetingSettings allowPrimaryBrowseAdTargetingSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowPrimaryBrowseAdTargetingSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowPrimaryBrowseAdTargetingSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowPrimaryBrowseAdTargetingChanged) { + AllowPrimaryBrowseAdTargetingSettings allowPrimaryBrowseAdTargetingSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowPrimaryBrowseAdTargetingSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowPrimaryBrowseAdTargetingSettings"; +} + +struct AllowPrimaryContentAdTargetingSettings : public Firebolt::Privacy::IPrivacy::IOnAllowPrimaryContentAdTargetingChangedNotification { + void onAllowPrimaryContentAdTargetingChanged(const bool) override; +}; + +void AllowPrimaryContentAdTargetingSettings::onAllowPrimaryContentAdTargetingChanged(const bool isAllowed) { + std::cout << "onAllowPrimaryContentAdTargetingChanged event fired"; +} + +TEST_F(PrivacyTest, subscribeOnAllowPrimaryContentAdTargetingChanged) { + AllowPrimaryContentAdTargetingSettings allowPrimaryContentAdTargetingSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowPrimaryContentAdTargetingSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowPrimaryContentAdTargetingSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowPrimaryContentAdTargetingChanged) { + AllowPrimaryContentAdTargetingSettings allowPrimaryContentAdTargetingSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowPrimaryContentAdTargetingSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowPrimaryContentAdTargetingSettings"; +} + +struct AllowProductAnalyticsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowProductAnalyticsChangedNotification { + void onAllowProductAnalyticsChanged(const bool) override; +}; + +void AllowProductAnalyticsSettings::onAllowProductAnalyticsChanged(const bool isAllowed) { + std::cout << "onAllowProductAnalyticsChanged event fired"; +} + +TEST_F(PrivacyTest, subscribeOnAllowProductAnalyticsChanged) { + AllowProductAnalyticsSettings allowProductAnalyticsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowProductAnalyticsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowProductAnalyticsSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowProductAnalyticsChanged) { + AllowProductAnalyticsSettings allowProductAnalyticsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowProductAnalyticsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowProductAnalyticsSettings"; +} + +struct AllowRemoteDiagnosticsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowRemoteDiagnosticsChangedNotification { + void onAllowRemoteDiagnosticsChanged(const bool) override; +}; + +void AllowRemoteDiagnosticsSettings::onAllowRemoteDiagnosticsChanged(const bool isAllowed) { + std::cout << "onAllowRemoteDiagnosticsChanged event fired with isAllowed: " << isAllowed; +} + +TEST_F(PrivacyTest, subscribeOnAllowRemoteDiagnosticsChanged) { + AllowRemoteDiagnosticsSettings allowRemoteDiagnosticsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowRemoteDiagnosticsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowRemoteDiagnosticsSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowRemoteDiagnosticsChanged) { + AllowRemoteDiagnosticsSettings allowRemoteDiagnosticsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowRemoteDiagnosticsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowRemoteDiagnosticsSettings"; +} + +struct AllowResumePointsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowResumePointsChangedNotification { + void onAllowResumePointsChanged(const bool) override; +}; + +void AllowResumePointsSettings::onAllowResumePointsChanged(const bool isAllowed) { + std::cout << "onAllowResumePointsChanged event fired with isAllowed: " << isAllowed; +} + +TEST_F(PrivacyTest, subscribeOnAllowResumePointsChanged) { + AllowResumePointsSettings allowResumePointsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowResumePointsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowResumePointsSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowResumePointsChanged) { + AllowResumePointsSettings allowResumePointsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowResumePointsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowResumePointsSettings"; +} + +struct AllowUnentitledPersonalizationSettings : public Firebolt::Privacy::IPrivacy::IOnAllowUnentitledPersonalizationChangedNotification { + void onAllowUnentitledPersonalizationChanged(const bool) override; +}; + +void AllowUnentitledPersonalizationSettings::onAllowUnentitledPersonalizationChanged(const bool isAllowed) { + std::cout << "onAllowUnentitledPersonalizationChanged event fired with isAllowed: " << isAllowed; +} + +TEST_F(PrivacyTest, subscribeOnAllowUnentitledPersonalizationChanged) { + AllowUnentitledPersonalizationSettings allowUnentitledPersonalizationSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowUnentitledPersonalizationSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowUnentitledPersonalizationSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowUnentitledPersonalizationChanged) { + AllowUnentitledPersonalizationSettings allowUnentitledPersonalizationSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowUnentitledPersonalizationSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowUnentitledPersonalizationSettings"; +} + +struct AllowUnentitledResumePointsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowUnentitledResumePointsChangedNotification { + void onAllowUnentitledResumePointsChanged(const bool) override; +}; + +void AllowUnentitledResumePointsSettings::onAllowUnentitledResumePointsChanged(const bool isAllowed) { + std::cout << "onAllowUnentitledResumePointsChanged event fired with isAllowed: " << isAllowed; +} + +TEST_F(PrivacyTest, subscribeOnAllowUnentitledResumePointsChanged) { + AllowUnentitledResumePointsSettings allowUnentitledResumePointsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowUnentitledResumePointsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowUnentitledResumePointsSettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowUnentitledResumePointsChanged) { + AllowUnentitledResumePointsSettings allowUnentitledResumePointsSettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowUnentitledResumePointsSettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowUnentitledResumePointsSettings"; +} + +struct AllowWatchHistorySettings : public Firebolt::Privacy::IPrivacy::IOnAllowWatchHistoryChangedNotification { + void onAllowWatchHistoryChanged(const bool) override; +}; + +void AllowWatchHistorySettings::onAllowWatchHistoryChanged(const bool isAllowed) { + std::cout << "onAllowWatchHistoryChanged event fired with isAllowed: " << isAllowed; +} + +TEST_F(PrivacyTest, subscribeOnAllowWatchHistoryChanged) { + AllowWatchHistorySettings allowWatchHistorySettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowWatchHistorySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowWatchHistorySettings"; +} + +TEST_F(PrivacyTest, unsubscribeOnAllowWatchHistoryChanged) { + AllowWatchHistorySettings allowWatchHistorySettings; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowWatchHistorySettings, &error); + EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowWatchHistorySettings"; +} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/unit.h b/src/sdks/manage/src/cpp/sdk/cpptest/unit/unit.h new file mode 100644 index 000000000..e5e0a7b2d --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/unit.h @@ -0,0 +1,4 @@ +#pragma once + +#include "gtest/gtest.h" +#include "../ManageSDKTest.h" \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp new file mode 100644 index 000000000..3dba5bd74 --- /dev/null +++ b/src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp @@ -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"; +}