| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" | 5 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // Drags to the left most position before the right tabs start pulling in. | 250 // Drags to the left most position before the right tabs start pulling in. |
| 251 { { 0, 240, 100, 10, 2, 0, 1, "0 90 140", "0 50 140" }, -40 }, | 251 { { 0, 240, 100, 10, 2, 0, 1, "0 90 140", "0 50 140" }, -40 }, |
| 252 // Drags 1 beyond the left most position, which should pull in the right | 252 // Drags 1 beyond the left most position, which should pull in the right |
| 253 // tab slightly. | 253 // tab slightly. |
| 254 { { 0, 240, 100, 10, 2, 0, 1, "0 90 140", "0 49 139" }, -41 }, | 254 { { 0, 240, 100, 10, 2, 0, 1, "0 90 140", "0 49 139" }, -41 }, |
| 255 // Drags to the left as far as the tab goes. | 255 // Drags to the left as far as the tab goes. |
| 256 { { 0, 240, 100, 10, 2, 0, 1, "0 90 140", "0 2 92" }, -88 }, | 256 { { 0, 240, 100, 10, 2, 0, 1, "0 90 140", "0 2 92" }, -88 }, |
| 257 // Drags one past as far to the left as the tab goes. Should keep pulling | 257 // Drags one past as far to the left as the tab goes. Should keep pulling |
| 258 // in the rightmost tab. | 258 // in the rightmost tab. |
| 259 { { 0, 240, 100, 10, 2, 0, 1, "0 90 140", "0 2 91" }, -89 }, | 259 { { 0, 240, 100, 10, 2, 0, 1, "0 90 140", "0 2 91" }, -89 }, |
| 260 |
| 261 // |
| 262 // The following set of tests create six tabs with the third selected. |
| 263 // |
| 264 // The x-position of the third tab is at its maximum, and the second tab is |
| 265 // stacked underneath. Dragging to the left moves the second tab to the |
| 266 // stack at the left-hand side of the tab strip. |
| 267 { { 0, 150, 100, 10, 2, 0, 2, "0 42 44 46 48 50", "0 2 43 46 48 50" }, -1 }, |
| 268 { { 0, 150, 100, 10, 2, 0, 2, "0 20 44 46 48 50", "0 2 41 46 48 50" }, -3 }, |
| 269 // The x-position of the third tab is not at its maximum. Dragging to the |
| 270 // left moves the second and third tabs by the same delta. |
| 271 { { 0, 150, 100, 10, 2, 0, 2, "0 25 35 46 48 50", "0 20 30 46 48 50" }, |
| 272 -5 }, |
| 273 // min x, fourth is flush against right side |
| 274 // The x-position of the third tab is at its minimum, and the fourth tab is |
| 275 // stacked underneath. Dragging to the right moves the fourth and fifth tabs |
| 276 // to the stack at the right-hand side of the tab strip. |
| 277 { { 0, 150, 100, 10, 2, 0, 2, "0 2 4 6 25 50", "0 2 11 46 48 50" }, 7 }, |
| 278 { { 0, 150, 100, 10, 2, 0, 2, "0 2 4 9 25 50", "0 2 7 46 48 50" }, 3 }, |
| 279 // The x-position of the third tab is not at its minimum. Dragging to the |
| 280 // right moves the third, fourth, and fifth tabs by the same delta. |
| 281 { { 0, 150, 100, 10, 2, 0, 2, "0 2 10 16 25 50", "0 2 11 17 26 50" }, 1 }, |
| 260 }; | 282 }; |
| 261 | 283 |
| 262 for (size_t i = 0; i < arraysize(test_data); ++i) { | 284 for (size_t i = 0; i < arraysize(test_data); ++i) { |
| 263 CreateLayout(test_data[i].common_data); | 285 CreateLayout(test_data[i].common_data); |
| 264 layout_->DragActiveTab(test_data[i].delta); | 286 layout_->DragActiveTab(test_data[i].delta); |
| 265 EXPECT_EQ(test_data[i].common_data.expected_bounds, BoundsString()) << | 287 EXPECT_EQ(test_data[i].common_data.expected_bounds, BoundsString()) << |
| 266 " at " << i; | 288 " at " << i; |
| 267 } | 289 } |
| 268 } | 290 } |
| 269 | 291 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // Location can be honored. | 579 // Location can be honored. |
| 558 { { 0, 300, 100, 10, 2, 0, 3, "", "0 2 4 40 130 198 200" }, 40 }, | 580 { { 0, 300, 100, 10, 2, 0, 3, "", "0 2 4 40 130 198 200" }, 40 }, |
| 559 }; | 581 }; |
| 560 for (size_t i = 0; i < arraysize(test_data); ++i) { | 582 for (size_t i = 0; i < arraysize(test_data); ++i) { |
| 561 CreateLayout(test_data[i].common_data); | 583 CreateLayout(test_data[i].common_data); |
| 562 layout_->SetActiveTabLocation(test_data[i].location); | 584 layout_->SetActiveTabLocation(test_data[i].location); |
| 563 EXPECT_EQ(test_data[i].common_data.expected_bounds, BoundsString()) << | 585 EXPECT_EQ(test_data[i].common_data.expected_bounds, BoundsString()) << |
| 564 " at " << i; | 586 " at " << i; |
| 565 } | 587 } |
| 566 } | 588 } |
| OLD | NEW |