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

Side by Side Diff: ui/views/bubble/bubble_border_unittest.cc

Issue 1778473002: MacViews: Fix failing bubble border tests after r375729. (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/bubble/bubble_border.h" 5 #include "ui/views/bubble/bubble_border.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const views::internal::BorderImages* kImages = border.GetImagesForTest(); 217 const views::internal::BorderImages* kImages = border.GetImagesForTest();
218 218
219 // kSmallSize is smaller than the minimum allowable size and does not 219 // kSmallSize is smaller than the minimum allowable size and does not
220 // contribute to the resulting size. 220 // contribute to the resulting size.
221 const gfx::Size kSmallSize = gfx::Size(1, 2); 221 const gfx::Size kSmallSize = gfx::Size(1, 2);
222 // kMediumSize is larger than the minimum allowable size and contributes to 222 // kMediumSize is larger than the minimum allowable size and contributes to
223 // the resulting size. 223 // the resulting size.
224 const gfx::Size kMediumSize = gfx::Size(50, 60); 224 const gfx::Size kMediumSize = gfx::Size(50, 60);
225 225
226 const gfx::Size kSmallHorizArrow( 226 const gfx::Size kSmallHorizArrow(
227 2 * kImages->border_thickness + kImages->top_arrow.width(), 227 2 * kImages->border_thickness + kImages->arrow_width,
228 kImages->border_thickness + kImages->arrow_thickness + 228 kImages->border_thickness + kImages->arrow_thickness +
229 kImages->border_interior_thickness); 229 kImages->border_interior_thickness);
230 230
231 const gfx::Size kSmallVertArrow(kSmallHorizArrow.height(), 231 const gfx::Size kSmallVertArrow(kSmallHorizArrow.height(),
232 kSmallHorizArrow.width()); 232 kSmallHorizArrow.width());
233 233
234 const gfx::Size kSmallNoArrow(2 * kImages->border_thickness, 234 const gfx::Size kSmallNoArrow(2 * kImages->border_thickness,
235 2 * kImages->border_thickness); 235 2 * kImages->border_thickness);
236 236
237 const gfx::Size kMediumHorizArrow( 237 const gfx::Size kMediumHorizArrow(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 338
339 border.set_arrow(BubbleBorder::NONE); 339 border.set_arrow(BubbleBorder::NONE);
340 const gfx::Size kTotalSizeWithNoArrow = 340 const gfx::Size kTotalSizeWithNoArrow =
341 border.GetSizeForContentsSize(kContentSize); 341 border.GetSizeForContentsSize(kContentSize);
342 342
343 const int kBorderThickness = border.GetBorderThickness(); 343 const int kBorderThickness = border.GetBorderThickness();
344 344
345 const int kArrowOffsetForHorizCenter = kTotalSizeWithHorizArrow.width() / 2; 345 const int kArrowOffsetForHorizCenter = kTotalSizeWithHorizArrow.width() / 2;
346 const int kArrowOffsetForVertCenter = kTotalSizeWithVertArrow.height() / 2; 346 const int kArrowOffsetForVertCenter = kTotalSizeWithVertArrow.height() / 2;
347 const int kArrowOffsetForNotCenter = 347 const int kArrowOffsetForNotCenter =
348 kImages->border_thickness + (kImages->top_arrow.width() / 2); 348 kImages->border_thickness + (kImages->arrow_width / 2);
349 349
350 const int kArrowSize = 350 const int kArrowSize =
351 kImages->arrow_interior_thickness + BubbleBorder::kStroke - 351 kImages->arrow_interior_thickness + BubbleBorder::kStroke -
352 kImages->arrow_thickness; 352 kImages->arrow_thickness;
353 353
354 const int kTopHorizArrowY = kAnchor.y() + kAnchor.height() + kArrowSize; 354 const int kTopHorizArrowY = kAnchor.y() + kAnchor.height() + kArrowSize;
355 const int kBottomHorizArrowY = 355 const int kBottomHorizArrowY =
356 kAnchor.y() - kArrowSize - kTotalSizeWithHorizArrow.height(); 356 kAnchor.y() - kArrowSize - kTotalSizeWithHorizArrow.height();
357 357
358 const int kLeftVertArrowX = kAnchor.x() + kAnchor.width() + kArrowSize; 358 const int kLeftVertArrowX = kAnchor.x() + kAnchor.width() + kArrowSize;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 EXPECT_GE(border_images->border_thickness, 440 EXPECT_GE(border_images->border_thickness,
441 border_images->border_interior_thickness); 441 border_images->border_interior_thickness);
442 442
443 // For a TOP_LEFT arrow, the x-offset always matches the border thickness. 443 // For a TOP_LEFT arrow, the x-offset always matches the border thickness.
444 EXPECT_EQ(border.GetArrowRect(rect).x(), border_images->border_thickness); 444 EXPECT_EQ(border.GetArrowRect(rect).x(), border_images->border_thickness);
445 border.Paint(paint_view, &canvas); 445 border.Paint(paint_view, &canvas);
446 } 446 }
447 } 447 }
448 448
449 } // namespace views 449 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698