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

Unified Diff: chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm

Issue 181011: [Mac] Make I-beam cursor match editing area. (Closed)
Patch Set: Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_cell.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm
diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm b/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm
index 1202a0ed4ec18438f222fe4bd2ae71b69beb04f6..b691d4d3abd57f0cc489c218534eea48eb44caec 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm
@@ -201,12 +201,16 @@ TEST_F(AutocompleteTextFieldCellTest, TextFrame) {
const NSRect bounds([view_ bounds]);
NSRect textFrame;
+ // The cursor frame should stay the same throughout.
+ const NSRect cursorFrame([cell textCursorFrameForFrame:bounds]);
+
// At default settings, everything goes to the text area.
textFrame = [cell textFrameForFrame:bounds];
EXPECT_FALSE(NSIsEmptyRect(textFrame));
EXPECT_TRUE(NSContainsRect(bounds, textFrame));
EXPECT_EQ(NSMinX(bounds), NSMinX(textFrame));
EXPECT_EQ(NSMaxX(bounds), NSMaxX(textFrame));
+ EXPECT_TRUE(NSEqualRects(cursorFrame, textFrame));
// Small search hint leaves text frame to left.
[cell setSearchHintString:@"Search hint"];
@@ -214,6 +218,7 @@ TEST_F(AutocompleteTextFieldCellTest, TextFrame) {
EXPECT_FALSE(NSIsEmptyRect(textFrame));
EXPECT_TRUE(NSContainsRect(bounds, textFrame));
EXPECT_LT(NSMaxX(textFrame), NSMaxX(bounds));
+ EXPECT_TRUE(NSContainsRect(cursorFrame, textFrame));
// Save search-hint's frame for future reference.
const CGFloat searchHintMaxX(NSMaxX(textFrame));
@@ -229,6 +234,7 @@ TEST_F(AutocompleteTextFieldCellTest, TextFrame) {
EXPECT_TRUE(NSContainsRect(bounds, textFrame));
EXPECT_LT(NSMaxX(textFrame), NSMaxX(bounds));
EXPECT_LT(NSMaxX(textFrame), searchHintMaxX);
+ EXPECT_TRUE(NSContainsRect(cursorFrame, textFrame));
// Keyword search leaves text area to right.
[cell setKeywordString:@"Search Engine:"];
@@ -238,6 +244,7 @@ TEST_F(AutocompleteTextFieldCellTest, TextFrame) {
EXPECT_GT(NSMinX(textFrame), NSMinX(bounds));
EXPECT_LT(NSMinX(textFrame), searchHintMaxX);
EXPECT_GT(NSMaxX(textFrame), searchHintMaxX);
+ EXPECT_TRUE(NSContainsRect(cursorFrame, textFrame));
// Text frame should take everything over again on reset.
[cell clearKeywordAndHint];
@@ -246,6 +253,7 @@ TEST_F(AutocompleteTextFieldCellTest, TextFrame) {
EXPECT_TRUE(NSContainsRect(bounds, textFrame));
EXPECT_EQ(NSMinX(bounds), NSMinX(textFrame));
EXPECT_EQ(NSMaxX(bounds), NSMaxX(textFrame));
+ EXPECT_TRUE(NSContainsRect(cursorFrame, textFrame));
}
} // namespace
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_cell.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698