summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/gradient_button_cell_unittest.mm
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 23:51:17 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 23:51:17 +0000
commit9b5d7374459f0deee6dbf7a5aa4dc43aec25e38c (patch)
tree06f68e313e76256c0245f7082dba8e6b23d7569e /chrome/browser/cocoa/gradient_button_cell_unittest.mm
parent15123a7ca58102854802075f6efb3c5e5cc23e23 (diff)
downloadchromium_src-9b5d7374459f0deee6dbf7a5aa4dc43aec25e38c.zip
chromium_src-9b5d7374459f0deee6dbf7a5aa4dc43aec25e38c.tar.gz
chromium_src-9b5d7374459f0deee6dbf7a5aa4dc43aec25e38c.tar.bz2
Updates to clean up default theme and add hover states.
Patch by Cole. BUG=http://crbug.com/18573;http://crbug.com/18574;http://crbug.com/18360;http://crbug.com/18438 TEST=none Review URL: http://codereview.chromium.org/165499 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/gradient_button_cell_unittest.mm')
-rw-r--r--chrome/browser/cocoa/gradient_button_cell_unittest.mm22
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/gradient_button_cell_unittest.mm b/chrome/browser/cocoa/gradient_button_cell_unittest.mm
index 3e0f162..e9229a7 100644
--- a/chrome/browser/cocoa/gradient_button_cell_unittest.mm
+++ b/chrome/browser/cocoa/gradient_button_cell_unittest.mm
@@ -9,6 +9,10 @@
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
+@interface GradientButtonCell (HoverValueTesting)
+- (void)adjustHoverValue;
+@end
+
namespace {
class GradientButtonCellTest : public testing::Test {
@@ -36,7 +40,25 @@ TEST_F(GradientButtonCellTest, AddRemove) {
// Test drawing, mostly to ensure nothing leaks or crashes.
TEST_F(GradientButtonCellTest, Display) {
+ [[view_ cell] setHoverAlpha:0.0];
+ [view_ display];
+ [[view_ cell] setHoverAlpha:0.5];
[view_ display];
+ [[view_ cell] setHoverAlpha:1.0];
+ [view_ display];
+}
+
+// Test drawing, mostly to ensure nothing leaks or crashes.
+TEST_F(GradientButtonCellTest, Hover) {
+ GradientButtonCell* cell = [view_ cell];
+ [cell setMouseInside:YES animate:NO];
+ EXPECT_EQ([[view_ cell] hoverAlpha], 1.0);
+
+ [cell setMouseInside:NO animate:YES];
+ CGFloat alpha1 = [cell hoverAlpha];
+ [cell adjustHoverValue];
+ CGFloat alpha2 = [cell hoverAlpha];
+ EXPECT_TRUE(alpha2 < alpha1);
}
// Tracking rects