Changeset 121698 in webkit


Ignore:
Timestamp:
Jul 2, 2012 12:12:23 PM (12 years ago)
Author:
noam.rosenthal@nokia.com
Message:

[Qt][WK2] New API tests introduced in r121620 fail
https://bugs.webkit.org/show_bug.cgi?id=90372

Reviewed by Luiz Agostini.

Updated the pixel comparison to produce more predictable results.

  • UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp:

(compareImages):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r121686 r121698  
     12012-07-02  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        [Qt][WK2] New API tests introduced in r121620 fail
     4        https://bugs.webkit.org/show_bug.cgi?id=90372
     5
     6        Reviewed by Luiz Agostini.
     7
     8        Updated the pixel comparison to produce more predictable results.
     9
     10        * UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp:
     11        (compareImages):
     12
    1132012-07-02  Alexis Menard  <alexis.menard@openbossa.org>
    214
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp

    r121620 r121698  
    120120}
    121121
    122 static bool compareImages(const QImage& i1, const QImage& i2, const QPoint& p1, const QPoint& p2, int iter)
    123 {
    124     const QPoint point((p1.x() + p2.x()) >> 1, (p1.y() + p2.y()) >> 1);
    125 
    126     if (i1.pixel(point) != i2.pixel(point))
    127         return false;
    128 
    129     if (!iter)
    130         return true;
    131 
    132     --iter;
    133     return compareImages(i1, i2, point, p1, iter) && compareImages(i1, i2, point, p2, iter)
    134         && compareImages(i1, i2, point, QPoint(p1.x(), p2.y()), iter) && compareImages(i1, i2, point, QPoint(p2.x(), p1.y()), iter);
    135 }
    136 
    137 static bool compareImages(const QImage& i1, const QImage& i2, int iter)
     122static bool compareImages(const QImage& i1, const QImage& i2, int count)
    138123{
    139124    if (i1.size() != i2.size())
    140125        return false;
    141     return compareImages(i1, i2, QPoint(0, 0), QPoint(i1.size().width(), i1.size().height()), iter);
     126    for (int x = 0; x < count; ++x) {
     127        for (int y = 0; y < count; ++y) {
     128            QPoint point(x * i1.width() / count, y * i1.height() / count);
     129            if (i1.pixel(point) != i2.pixel(point))
     130                return false;
     131        }
     132    }
     133
     134    return true;
    142135}
    143136
Note: See TracChangeset for help on using the changeset viewer.