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

Side by Side Diff: ui/views/widget/native_widget_mac_unittest.mm

Issue 2009333002: Converts Widget::SetOpacity from char to float (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « ui/views/widget/native_widget_mac.mm ('k') | ui/views/widget/native_widget_private.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/widget/native_widget_mac.h" 5 #import "ui/views/widget/native_widget_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/foundation_util.h" 9 #import "base/mac/foundation_util.h"
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 actual = gfx::ScreenRectToNSRect(widget.GetWorkAreaBoundsInScreen()); 1252 actual = gfx::ScreenRectToNSRect(widget.GetWorkAreaBoundsInScreen());
1253 EXPECT_TRUE(NSIsEmptyRect(actual)); 1253 EXPECT_TRUE(NSIsEmptyRect(actual));
1254 } 1254 }
1255 1255
1256 // Test that Widget opacity can be changed. 1256 // Test that Widget opacity can be changed.
1257 TEST_F(NativeWidgetMacTest, ChangeOpacity) { 1257 TEST_F(NativeWidgetMacTest, ChangeOpacity) {
1258 Widget* widget = CreateTopLevelPlatformWidget(); 1258 Widget* widget = CreateTopLevelPlatformWidget();
1259 NSWindow* ns_window = widget->GetNativeWindow(); 1259 NSWindow* ns_window = widget->GetNativeWindow();
1260 1260
1261 CGFloat old_opacity = [ns_window alphaValue]; 1261 CGFloat old_opacity = [ns_window alphaValue];
1262 widget->SetOpacity(0xAA); 1262 widget->SetOpacity(.7f);
1263 EXPECT_NE(old_opacity, [ns_window alphaValue]); 1263 EXPECT_NE(old_opacity, [ns_window alphaValue]);
1264 EXPECT_DOUBLE_EQ(0xAA / 255.0, [ns_window alphaValue]); 1264 EXPECT_DOUBLE_EQ(.7, [ns_window alphaValue]);
1265 1265
1266 widget->CloseNow(); 1266 widget->CloseNow();
1267 } 1267 }
1268 1268
1269 // Test that NativeWidgetMac::SchedulePaintInRect correctly passes the dirtyRect 1269 // Test that NativeWidgetMac::SchedulePaintInRect correctly passes the dirtyRect
1270 // parameter to BridgedContentView::drawRect, for a titled window (window with a 1270 // parameter to BridgedContentView::drawRect, for a titled window (window with a
1271 // toolbar). 1271 // toolbar).
1272 TEST_F(NativeWidgetMacTest, SchedulePaintInRect_Titled) { 1272 TEST_F(NativeWidgetMacTest, SchedulePaintInRect_Titled) {
1273 Widget* widget = CreateTopLevelPlatformWidget(); 1273 Widget* widget = CreateTopLevelPlatformWidget();
1274 1274
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 lastDirtyRect_ = dirtyRect; 1585 lastDirtyRect_ = dirtyRect;
1586 } 1586 }
1587 1587
1588 @end 1588 @end
1589 1589
1590 @implementation FocusableTestNSView 1590 @implementation FocusableTestNSView
1591 - (BOOL)acceptsFirstResponder { 1591 - (BOOL)acceptsFirstResponder {
1592 return YES; 1592 return YES;
1593 } 1593 }
1594 @end 1594 @end
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_mac.mm ('k') | ui/views/widget/native_widget_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698