Test for NoSwitchesModalPresenter 43/218743/3 submit/tizen/20191202.210542
authorTomasz Okoniewski <t.okoniewski@partner.samsung.com>
Wed, 27 Nov 2019 14:51:33 +0000 (15:51 +0100)
committerOskar Chodowicz <o.chodowicz@partner.samsung.com>
Mon, 2 Dec 2019 17:22:11 +0000 (18:22 +0100)
Change-Id: I735bef0281ed81981e92f07067a07fd8b8e33d2e

tests/no-ui-scenarios/NoSwitchesModalPresenterTest.cpp [new file with mode: 0644]

diff --git a/tests/no-ui-scenarios/NoSwitchesModalPresenterTest.cpp b/tests/no-ui-scenarios/NoSwitchesModalPresenterTest.cpp
new file mode 100644 (file)
index 0000000..a95b2b1
--- /dev/null
@@ -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 <gtest/gtest.h>
+
+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;
+       }
+}