container_full_width_behavior_unittest.cc 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/keyboard/ui/container_full_width_behavior.h"
  5. #include "testing/gtest/include/gtest/gtest.h"
  6. #include "ui/gfx/geometry/rect.h"
  7. namespace keyboard {
  8. TEST(ContainerFullWidthBehaviorTest, AdjustSetBoundsRequest) {
  9. ContainerFullWidthBehavior full_width_behavior(nullptr);
  10. // workspace is not always necessarily positioned at the origin (e.g.
  11. // secondary display).
  12. gfx::Rect workspace(20, -30, 300, 200);
  13. gfx::Rect requested_bounds(0, 0, 10, 10);
  14. gfx::Rect result;
  15. // Ignore width. Stretch the bounds across the bottom of the screen.
  16. result =
  17. full_width_behavior.AdjustSetBoundsRequest(workspace, requested_bounds);
  18. ASSERT_EQ(gfx::Rect(20, 160, 300, 10), result);
  19. // Even if the coordinates are non-zero, ignore them. Only use height.
  20. requested_bounds = gfx::Rect(30, 80, 20, 100);
  21. result =
  22. full_width_behavior.AdjustSetBoundsRequest(workspace, requested_bounds);
  23. ASSERT_EQ(gfx::Rect(20, 70, 300, 100), result);
  24. }
  25. } // namespace keyboard