From 4db8a094bd7ec46b7cba15ff1e3a7d717a970b22 Mon Sep 17 00:00:00 2001 From: Tomasz Okoniewski Date: Wed, 27 Nov 2019 15:51:33 +0100 Subject: [PATCH] Test for NoSwitchesModalPresenter Change-Id: I735bef0281ed81981e92f07067a07fd8b8e33d2e --- .../NoSwitchesModalPresenterTest.cpp | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/no-ui-scenarios/NoSwitchesModalPresenterTest.cpp diff --git a/tests/no-ui-scenarios/NoSwitchesModalPresenterTest.cpp b/tests/no-ui-scenarios/NoSwitchesModalPresenterTest.cpp new file mode 100644 index 0000000..a95b2b1 --- /dev/null +++ b/tests/no-ui-scenarios/NoSwitchesModalPresenterTest.cpp @@ -0,0 +1,56 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "NoSwitchesModalPresenter.hpp" + +#include + +TEST(NoSwitchesModalPresenter, testConstructor) +{ + auto nsmp = new NoSwitchesModalPresenter(); + EXPECT_STRCASEEQ("IDS_ACCS_UNIVERSAL_SWITCH_NO_SWITCHES_TEXT", nsmp->getText().c_str()); +} + +TEST(NoSwitchesModalPresenter, testAction) +{ + auto nsmp = new NoSwitchesModalPresenter(); + + auto cancel_action = nsmp->getAction("cancelAction"); + + ASSERT_NE(cancel_action, nullptr); + EXPECT_EQ(cancel_action->actionId_, std::string("cancelAction")); + EXPECT_EQ(cancel_action->title_.value(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_CANCEL")); + EXPECT_TRUE(cancel_action->enabled_.value()); + EXPECT_FALSE(cancel_action->state_.value()); + + auto done_action = nsmp->getAction("doneAction"); + + ASSERT_NE(done_action, nullptr); + EXPECT_EQ(done_action->actionId_, std::string("doneAction")); + EXPECT_EQ(done_action->title_.value(), std::string("IDS_ACCS_UNIVERSAL_SWITCH_POPUP_ADD")); + EXPECT_TRUE(done_action->enabled_.value()); + EXPECT_FALSE(done_action->state_.value()); +} + +int main(int argc, char *argv[]) +{ + try { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); + } catch (...) { + return 1; + } +} -- 2.7.4