| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "apps/moterm/moterm_model.h" | 5 #include "apps/moterm/moterm_model.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 EXPECT_FALSE(state_changes.IsDirty()); | 124 EXPECT_FALSE(state_changes.IsDirty()); |
| 125 | 125 |
| 126 state_changes.dirty_rect = MotermModel::Rectangle(1, 2, 34, 56); | 126 state_changes.dirty_rect = MotermModel::Rectangle(1, 2, 34, 56); |
| 127 EXPECT_TRUE(state_changes.IsDirty()); | 127 EXPECT_TRUE(state_changes.IsDirty()); |
| 128 state_changes.Reset(); | 128 state_changes.Reset(); |
| 129 EXPECT_TRUE(state_changes.dirty_rect.IsEmpty()); | 129 EXPECT_TRUE(state_changes.dirty_rect.IsEmpty()); |
| 130 EXPECT_FALSE(state_changes.IsDirty()); | 130 EXPECT_FALSE(state_changes.IsDirty()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 TEST(MotermModelTest, Basic) { | 133 TEST(MotermModelTest, Basic) { |
| 134 MotermModel model(MotermModel::Size(43, 132), MotermModel::Size(25, 80)); | 134 MotermModel model(MotermModel::Size(43, 132), MotermModel::Size(25, 80), |
| 135 nullptr); |
| 135 | 136 |
| 136 MotermModel::Size size = model.GetSize(); | 137 MotermModel::Size size = model.GetSize(); |
| 137 EXPECT_EQ(25u, size.rows); | 138 EXPECT_EQ(25u, size.rows); |
| 138 EXPECT_EQ(80u, size.columns); | 139 EXPECT_EQ(80u, size.columns); |
| 139 | 140 |
| 140 // The cursor should start out at the upper-left. | 141 // The cursor should start out at the upper-left. |
| 141 MotermModel::Position cursor_pos = model.GetCursorPosition(); | 142 MotermModel::Position cursor_pos = model.GetCursorPosition(); |
| 142 EXPECT_EQ(0, cursor_pos.row); | 143 EXPECT_EQ(0, cursor_pos.row); |
| 143 EXPECT_EQ(0, cursor_pos.column); | 144 EXPECT_EQ(0, cursor_pos.column); |
| 144 | 145 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 size = model.GetSize(); | 194 size = model.GetSize(); |
| 194 EXPECT_EQ(43u, size.rows); | 195 EXPECT_EQ(43u, size.rows); |
| 195 EXPECT_EQ(132u, size.columns); | 196 EXPECT_EQ(132u, size.columns); |
| 196 | 197 |
| 197 model.SetSize(MotermModel::Size(40, 100), true); | 198 model.SetSize(MotermModel::Size(40, 100), true); |
| 198 size = model.GetSize(); | 199 size = model.GetSize(); |
| 199 EXPECT_EQ(40u, size.rows); | 200 EXPECT_EQ(40u, size.rows); |
| 200 EXPECT_EQ(100u, size.columns); | 201 EXPECT_EQ(100u, size.columns); |
| 201 } | 202 } |
| 202 | 203 |
| 204 // TODO(vtl): Test responses. |
| 205 |
| 203 } // namespace | 206 } // namespace |
| OLD | NEW |