[Chromium] Fix warnings on Windows build
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2012 00:33:21 +0000 (00:33 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2012 00:33:21 +0000 (00:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=93997

Patch by Scott Graham <scottmg@chromium.org> on 2012-08-14
Reviewed by Kentaro Hara.

Fixes truncation from 'double' to 'float' warnings on Chromium Windows
build.

* tests/CCRenderSurfaceFiltersTest.cpp:
(WebKit::TEST):
* tests/CCScrollbarAnimationControllerLinearFadeTest.cpp:
(WebCore::TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125625 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCRenderSurfaceFiltersTest.cpp
Source/WebKit/chromium/tests/CCScrollbarAnimationControllerLinearFadeTest.cpp

index a06041d..2678bb1 100644 (file)
@@ -1,3 +1,18 @@
+2012-08-14  Scott Graham  <scottmg@chromium.org>
+
+        [Chromium] Fix warnings on Windows build
+        https://bugs.webkit.org/show_bug.cgi?id=93997
+
+        Reviewed by Kentaro Hara.
+
+        Fixes truncation from 'double' to 'float' warnings on Chromium Windows
+        build.
+
+        * tests/CCRenderSurfaceFiltersTest.cpp:
+        (WebKit::TEST):
+        * tests/CCScrollbarAnimationControllerLinearFadeTest.cpp:
+        (WebCore::TEST_F):
+
 2012-08-14  Chris Rogers  <crogers@google.com>
 
         Implement new synchronized audio I/O render method in chromium
index b56a7fb..1d2a9c5 100644 (file)
@@ -52,27 +52,30 @@ TEST(CCRenderSurfaceFiltersTest, testColorMatrixFiltersCombined)
     // Several filters should always combine for any amount between 0 and 1:
     // grayscale, saturate, invert, contrast, opacity.
     EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(0)));
-    EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(0.3)));
+    // Note that we use 0.3f to avoid "argument is truncated from 'double' to
+    // 'float'" warnings on Windows. 0.5 is exactly representable as a float, so
+    // there is no warning.
+    EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(0.3f)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(0.5)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createGrayscaleFilter(1)));
 
     EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(0)));
-    EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(0.3)));
+    EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(0.3f)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(0.5)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createSaturateFilter(1)));
 
     EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(0)));
-    EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(0.3)));
+    EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(0.3f)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(0.5)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createInvertFilter(1)));
 
     EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(0)));
-    EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(0.3)));
+    EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(0.3f)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(0.5)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createContrastFilter(1)));
 
     EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(0)));
-    EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(0.3)));
+    EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(0.3f)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(0.5)));
     EXPECT_TRUE(isCombined(WebFilterOperation::createOpacityFilter(1)));
 
index e6cdc24..4287d36 100644 (file)
@@ -84,9 +84,11 @@ TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyAwakenByScroll)
     m_scrollbarController->animate(3);
     EXPECT_FLOAT_EQ(1, m_scrollbarLayer->opacity());
     m_scrollbarController->animate(4);
-    EXPECT_FLOAT_EQ(2 / 3.0, m_scrollbarLayer->opacity());
+    // Note that we use 3.0f to avoid "argument is truncated from 'double' to
+    // 'float'" warnings on Windows.
+    EXPECT_FLOAT_EQ(2 / 3.0f, m_scrollbarLayer->opacity());
     m_scrollbarController->animate(5);
-    EXPECT_FLOAT_EQ(1 / 3.0, m_scrollbarLayer->opacity());
+    EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity());
     m_scrollLayer->setScrollDelta(IntSize(3, 3));
     m_scrollbarController->updateScrollOffsetAtTime(m_scrollLayer.get(), 5);
     m_scrollbarController->animate(6);
@@ -94,9 +96,9 @@ TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyAwakenByScroll)
     m_scrollbarController->animate(7);
     EXPECT_FLOAT_EQ(1, m_scrollbarLayer->opacity());
     m_scrollbarController->animate(8);
-    EXPECT_FLOAT_EQ(2 / 3.0, m_scrollbarLayer->opacity());
+    EXPECT_FLOAT_EQ(2 / 3.0f, m_scrollbarLayer->opacity());
     m_scrollbarController->animate(9);
-    EXPECT_FLOAT_EQ(1 / 3.0, m_scrollbarLayer->opacity());
+    EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity());
     m_scrollbarController->animate(10);
     EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity());
 }
@@ -127,9 +129,9 @@ TEST_F(CCScrollbarAnimationControllerLinearFadeTest, verifyForceAwakenByPinch)
     m_scrollbarController->animate(8);
     EXPECT_FLOAT_EQ(1, m_scrollbarLayer->opacity());
     m_scrollbarController->animate(9);
-    EXPECT_FLOAT_EQ(2 / 3.0, m_scrollbarLayer->opacity());
+    EXPECT_FLOAT_EQ(2 / 3.0f, m_scrollbarLayer->opacity());
     m_scrollbarController->animate(10);
-    EXPECT_FLOAT_EQ(1 / 3.0, m_scrollbarLayer->opacity());
+    EXPECT_FLOAT_EQ(1 / 3.0f, m_scrollbarLayer->opacity());
     m_scrollbarController->animate(11);
     EXPECT_FLOAT_EQ(0, m_scrollbarLayer->opacity());