summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-05-04 11:34:33 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-05-04 11:34:33 +0200
commit0b72b7dc67de38d7b6aabb1b9d709564b366d5af (patch)
treeed48a00a97ba96e5388d1b3420ac425b81b35217 /tests
parentSnap for 4754751 from 7ffa008463d282902fe96decddb6aa8250bc6161 to qt-release (diff)
parentMerge "Move menu headers/items to std::vector<std::string>." am: fb86bb2a07 am: 0d9ed29541 (diff)
downloadandroid_bootable_recovery-0b72b7dc67de38d7b6aabb1b9d709564b366d5af.tar
android_bootable_recovery-0b72b7dc67de38d7b6aabb1b9d709564b366d5af.tar.gz
android_bootable_recovery-0b72b7dc67de38d7b6aabb1b9d709564b366d5af.tar.bz2
android_bootable_recovery-0b72b7dc67de38d7b6aabb1b9d709564b366d5af.tar.lz
android_bootable_recovery-0b72b7dc67de38d7b6aabb1b9d709564b366d5af.tar.xz
android_bootable_recovery-0b72b7dc67de38d7b6aabb1b9d709564b366d5af.tar.zst
android_bootable_recovery-0b72b7dc67de38d7b6aabb1b9d709564b366d5af.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/screen_ui_test.cpp41
1 files changed, 15 insertions, 26 deletions
diff --git a/tests/unit/screen_ui_test.cpp b/tests/unit/screen_ui_test.cpp
index be6799f2e..e47d7054b 100644
--- a/tests/unit/screen_ui_test.cpp
+++ b/tests/unit/screen_ui_test.cpp
@@ -14,21 +14,22 @@
* limitations under the License.
*/
-#include "screen_ui.h"
+#include <stddef.h>
#include <string>
+#include <vector>
#include <gtest/gtest.h>
-constexpr const char* HEADER[] = { "header", nullptr };
-constexpr const char* ITEMS[] = { "items1", "items2", "items3", "items4", "1234567890", nullptr };
+#include "screen_ui.h"
+
+static const std::vector<std::string> HEADERS{ "header" };
+static const std::vector<std::string> ITEMS{ "item1", "item2", "item3", "item4", "1234567890" };
TEST(ScreenUITest, StartPhoneMenuSmoke) {
- Menu menu(false, 10, 20);
+ Menu menu(false, 10, 20, HEADERS, ITEMS, 0);
ASSERT_FALSE(menu.scrollable());
-
- menu.Start(HEADER, ITEMS, 0);
- ASSERT_EQ(HEADER[0], menu.text_headers()[0]);
+ ASSERT_EQ(HEADERS[0], menu.text_headers()[0]);
ASSERT_EQ(5u, menu.ItemsCount());
std::string message;
@@ -41,11 +42,9 @@ TEST(ScreenUITest, StartPhoneMenuSmoke) {
}
TEST(ScreenUITest, StartWearMenuSmoke) {
- Menu menu(true, 10, 8);
+ Menu menu(true, 10, 8, HEADERS, ITEMS, 1);
ASSERT_TRUE(menu.scrollable());
-
- menu.Start(HEADER, ITEMS, 1);
- ASSERT_EQ(HEADER[0], menu.text_headers()[0]);
+ ASSERT_EQ(HEADERS[0], menu.text_headers()[0]);
ASSERT_EQ(5u, menu.ItemsCount());
std::string message;
@@ -59,10 +58,8 @@ TEST(ScreenUITest, StartWearMenuSmoke) {
}
TEST(ScreenUITest, StartPhoneMenuItemsOverflow) {
- Menu menu(false, 1, 20);
+ Menu menu(false, 1, 20, HEADERS, ITEMS, 0);
ASSERT_FALSE(menu.scrollable());
-
- menu.Start(HEADER, ITEMS, 0);
ASSERT_EQ(1u, menu.ItemsCount());
std::string message;
@@ -76,10 +73,8 @@ TEST(ScreenUITest, StartPhoneMenuItemsOverflow) {
}
TEST(ScreenUITest, StartWearMenuItemsOverflow) {
- Menu menu(true, 1, 20);
+ Menu menu(true, 1, 20, HEADERS, ITEMS, 0);
ASSERT_TRUE(menu.scrollable());
-
- menu.Start(HEADER, ITEMS, 0);
ASSERT_EQ(5u, menu.ItemsCount());
std::string message;
@@ -95,10 +90,8 @@ TEST(ScreenUITest, StartWearMenuItemsOverflow) {
}
TEST(ScreenUITest, PhoneMenuSelectSmoke) {
- Menu menu(false, 10, 20);
-
int sel = 0;
- menu.Start(HEADER, ITEMS, sel);
+ Menu menu(false, 10, 20, HEADERS, ITEMS, sel);
// Mimic down button 10 times (2 * items size)
for (int i = 0; i < 10; i++) {
sel = menu.Select(++sel);
@@ -126,10 +119,8 @@ TEST(ScreenUITest, PhoneMenuSelectSmoke) {
}
TEST(ScreenUITest, WearMenuSelectSmoke) {
- Menu menu(true, 10, 20);
-
int sel = 0;
- menu.Start(HEADER, ITEMS, sel);
+ Menu menu(true, 10, 20, HEADERS, ITEMS, sel);
// Mimic pressing down button 10 times (2 * items size)
for (int i = 0; i < 10; i++) {
sel = menu.Select(++sel);
@@ -157,10 +148,8 @@ TEST(ScreenUITest, WearMenuSelectSmoke) {
}
TEST(ScreenUITest, WearMenuSelectItemsOverflow) {
- Menu menu(true, 3, 20);
-
int sel = 1;
- menu.Start(HEADER, ITEMS, sel);
+ Menu menu(true, 3, 20, HEADERS, ITEMS, sel);
ASSERT_EQ(5u, menu.ItemsCount());
// Scroll the menu to the end, and check the start & end of menu.