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

Side by Side Diff: chrome/browser/cocoa/styled_text_field_cell_unittest.mm

Issue 2876002: Mac/clang: First pass over unit_tests (Closed)
Patch Set: '' Created 10 years, 6 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #import "chrome/browser/cocoa/styled_text_field_cell.h" 8 #import "chrome/browser/cocoa/styled_text_field_cell.h"
9 #import "chrome/browser/cocoa/styled_text_field_test_helper.h" 9 #import "chrome/browser/cocoa/styled_text_field_test_helper.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h" 10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 // The editor frame should be slightly inset from the text frame. 65 // The editor frame should be slightly inset from the text frame.
66 TEST_F(StyledTextFieldCellTest, DrawingRectForBounds) { 66 TEST_F(StyledTextFieldCellTest, DrawingRectForBounds) {
67 const NSRect bounds = [view_ bounds]; 67 const NSRect bounds = [view_ bounds];
68 NSRect textFrame = [cell_ textFrameForFrame:bounds]; 68 NSRect textFrame = [cell_ textFrameForFrame:bounds];
69 NSRect drawingRect = [cell_ drawingRectForBounds:bounds]; 69 NSRect drawingRect = [cell_ drawingRectForBounds:bounds];
70 70
71 EXPECT_FALSE(NSIsEmptyRect(drawingRect)); 71 EXPECT_FALSE(NSIsEmptyRect(drawingRect));
72 EXPECT_TRUE(NSContainsRect(textFrame, NSInsetRect(drawingRect, 1, 1))); 72 EXPECT_TRUE(NSContainsRect(textFrame, NSInsetRect(drawingRect, 1, 1)));
73 73
74 // Save the starting frame for after clear.
75 const NSRect originalDrawingRect = drawingRect;
76
77 [cell_ setLeftMargin:10]; 74 [cell_ setLeftMargin:10];
78 textFrame = [cell_ textFrameForFrame:bounds]; 75 textFrame = [cell_ textFrameForFrame:bounds];
79 drawingRect = [cell_ drawingRectForBounds:bounds]; 76 drawingRect = [cell_ drawingRectForBounds:bounds];
80 EXPECT_FALSE(NSIsEmptyRect(drawingRect)); 77 EXPECT_FALSE(NSIsEmptyRect(drawingRect));
81 EXPECT_TRUE(NSContainsRect(textFrame, NSInsetRect(drawingRect, 1, 1))); 78 EXPECT_TRUE(NSContainsRect(textFrame, NSInsetRect(drawingRect, 1, 1)));
82 79
83 [cell_ setRightMargin:20]; 80 [cell_ setRightMargin:20];
84 textFrame = [cell_ textFrameForFrame:bounds]; 81 textFrame = [cell_ textFrameForFrame:bounds];
85 drawingRect = [cell_ drawingRectForBounds:bounds]; 82 drawingRect = [cell_ drawingRectForBounds:bounds];
86 EXPECT_FALSE(NSIsEmptyRect(drawingRect)); 83 EXPECT_FALSE(NSIsEmptyRect(drawingRect));
87 EXPECT_TRUE(NSContainsRect(NSInsetRect(textFrame, 1, 1), drawingRect)); 84 EXPECT_TRUE(NSContainsRect(NSInsetRect(textFrame, 1, 1), drawingRect));
88 85
89 [cell_ setLeftMargin:0]; 86 [cell_ setLeftMargin:0];
90 textFrame = [cell_ textFrameForFrame:bounds]; 87 textFrame = [cell_ textFrameForFrame:bounds];
91 drawingRect = [cell_ drawingRectForBounds:bounds]; 88 drawingRect = [cell_ drawingRectForBounds:bounds];
92 EXPECT_FALSE(NSIsEmptyRect(drawingRect)); 89 EXPECT_FALSE(NSIsEmptyRect(drawingRect));
93 EXPECT_TRUE(NSContainsRect(NSInsetRect(textFrame, 1, 1), drawingRect)); 90 EXPECT_TRUE(NSContainsRect(NSInsetRect(textFrame, 1, 1), drawingRect));
94 } 91 }
95 92
96 } // namespace 93 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698