Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: ash/display/display_util_unittest.cc

Issue 1823913002: Allow moving cursors between connected displays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/display/display_util_unittest.cc
diff --git a/ash/display/display_util_unittest.cc b/ash/display/display_util_unittest.cc
index 14e3b03a9dd5c2c2d3aefa7e349a481803dff75d..10866ba19c088c45c474f3e91118aacb9c2a27d9 100644
--- a/ash/display/display_util_unittest.cc
+++ b/ash/display/display_util_unittest.cc
@@ -98,12 +98,26 @@ TEST_F(DisplayUtilTest, GenerateDisplayIdList) {
list = GenerateDisplayIdList(std::begin(ids), std::end(ids));
EXPECT_EQ(1, list[0]);
EXPECT_EQ(10, list[1]);
+
+ int64_t three_ids[] = {10, 5, 1};
+ list = GenerateDisplayIdList(std::begin(three_ids), std::end(three_ids));
+ ASSERT_EQ(3u, list.size());
+ EXPECT_EQ(1, list[0]);
+ EXPECT_EQ(5, list[1]);
+ EXPECT_EQ(10, list[2]);
}
{
int64_t ids[] = {10, 100};
list = GenerateDisplayIdList(std::begin(ids), std::end(ids));
EXPECT_EQ(10, list[0]);
EXPECT_EQ(100, list[1]);
+
+ int64_t three_ids[] = {10, 100, 1000};
+ list = GenerateDisplayIdList(std::begin(three_ids), std::end(three_ids));
+ ASSERT_EQ(3u, list.size());
+ EXPECT_EQ(10, list[0]);
+ EXPECT_EQ(100, list[1]);
+ EXPECT_EQ(1000, list[2]);
}
{
test::ScopedSetInternalDisplayId set_internal(100);
@@ -116,6 +130,13 @@ TEST_F(DisplayUtilTest, GenerateDisplayIdList) {
list = GenerateDisplayIdList(std::begin(ids), std::end(ids));
EXPECT_EQ(100, list[0]);
EXPECT_EQ(10, list[1]);
+
+ int64_t three_ids[] = {10, 100, 1000};
+ list = GenerateDisplayIdList(std::begin(three_ids), std::end(three_ids));
+ ASSERT_EQ(3u, list.size());
+ EXPECT_EQ(100, list[0]);
+ EXPECT_EQ(10, list[1]);
+ EXPECT_EQ(1000, list[2]);
}
{
test::ScopedSetInternalDisplayId set_internal(10);
@@ -128,6 +149,27 @@ TEST_F(DisplayUtilTest, GenerateDisplayIdList) {
list = GenerateDisplayIdList(std::begin(ids), std::end(ids));
EXPECT_EQ(10, list[0]);
EXPECT_EQ(100, list[1]);
+
+ int64_t three_ids[] = {10, 100, 1000};
+ list = GenerateDisplayIdList(std::begin(three_ids), std::end(three_ids));
+ ASSERT_EQ(3u, list.size());
+ EXPECT_EQ(10, list[0]);
+ EXPECT_EQ(100, list[1]);
+ EXPECT_EQ(1000, list[2]);
+ }
+}
+
+TEST_F(DisplayUtilTest, DisplayIdListToString) {
+ {
+ int64_t ids[] = {10, 1, 16};
+ DisplayIdList list = GenerateDisplayIdList(std::begin(ids), std::end(ids));
+ EXPECT_EQ("1,10,16", DisplayIdListToString(list));
+ }
+ {
+ test::ScopedSetInternalDisplayId set_internal(16);
+ int64_t ids[] = {10, 1, 16};
+ DisplayIdList list = GenerateDisplayIdList(std::begin(ids), std::end(ids));
+ EXPECT_EQ("16,1,10", DisplayIdListToString(list));
}
}

Powered by Google App Engine
This is Rietveld 408576698