Bug 42527

Summary: [Qt] tst_QWebElement fails firstChildNextSibling and lastChildPreviousSibling
Product: WebKit Reporter: Andreas Kling <kling>
Component: Tools / TestsAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: hausmann
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Proposed patch none

Description Andreas Kling 2010-07-18 15:26:36 PDT
Running current Qt 4.7 and WebKit ToT:

FAIL!  : tst_QWebElement::firstChildNextSibling() '!table.isNull()' returned FALSE. ()
   Loc: [tst_qwebelement.cpp(898)]
FAIL!  : tst_QWebElement::lastChildPreviousSibling() Compared values are not the same
   Actual (table.tagName()): P
   Expected (QString("TABLE")): TABLE
   Loc: [tst_qwebelement.cpp(911)]

The test fails because it's using invalid HTML:

<body><!--comment--><p>Test</p><!--another comment><table>

The correct way to write this would be:

<body><!--comment--><p>Test</p><!--another comment--><table>

HTML5 has the following to say about comments:

Comments must start with the four character sequence U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS (<!--). Following this sequence, the comment may have text, with the additional restriction that the text must not start with a single U+003E GREATER-THAN SIGN character (>), nor start with a U+002D HYPHEN-MINUS character (-) followed by a U+003E GREATER-THAN SIGN (>) character, nor contain two consecutive U+002D HYPHEN-MINUS characters (--), nor end with a U+002D HYPHEN-MINUS character (-). Finally, the comment must be ended by the three character sequence U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN (-->).

http://www.whatwg.org/specs/web-apps/current-work/#comments
Comment 1 Andreas Kling 2010-07-18 15:30:59 PDT
Created attachment 61915 [details]
Proposed patch

Correct the HTML used by these tests.
Comment 2 Antonio Gomes 2010-07-18 15:49:20 PDT
Comment on attachment 61915 [details]
Proposed patch

> diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
> index efbee15..31b488f 100644
> --- a/WebKit/qt/ChangeLog
> +++ b/WebKit/qt/ChangeLog
> @@ -1,3 +1,16 @@
> +2010-07-18  Andreas Kling  <andreas.kling@nokia.com>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        [Qt] tst_QWebElement fails firstChildNextSibling and lastChildPreviousSibling
> +        https://bugs.webkit.org/show_bug.cgi?id=42527
> +
> +        Correct the HTML used by these tests.
> +
> +        * tests/qwebelement/tst_qwebelement.cpp:
> +        (tst_QWebElement::firstChildNextSibling):
> +        (tst_QWebElement::lastChildPreviousSibling):
> +
>  2010-07-16  Zhe Su  <suzhe@chromium.org>
>  
>          Reviewed by Darin Adler.
> diff --git a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
> index 8db0ec3..2f1097a 100644
> --- a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
> +++ b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
> @@ -887,7 +887,7 @@ void tst_QWebElement::nullSelect()
>  
>  void tst_QWebElement::firstChildNextSibling()
>  {
> -    m_mainFrame->setHtml("<body><!--comment--><p>Test</p><!--another commend><table>");
> +    m_mainFrame->setHtml("<body><!--comment--><p>Test</p><!--another comment--><table>");
>  
>      QWebElement body = m_mainFrame->findFirstElement("body");
>      QVERIFY(!body.isNull());
> @@ -902,7 +902,7 @@ void tst_QWebElement::firstChildNextSibling()
>  
>  void tst_QWebElement::lastChildPreviousSibling()
>  {
> -    m_mainFrame->setHtml("<body><!--comment--><p>Test</p><!--another commend><table>");
> +    m_mainFrame->setHtml("<body><!--comment--><p>Test</p><!--another comment--><table>");
>  
>      QWebElement body = m_mainFrame->findFirstElement("body");
>      QVERIFY(!body.isNull());
Comment 3 Andreas Kling 2010-07-18 15:55:46 PDT
Comment on attachment 61915 [details]
Proposed patch

Clearing flags on attachment: 61915

Committed r63637: <http://trac.webkit.org/changeset/63637>
Comment 4 Andreas Kling 2010-07-18 15:55:57 PDT
All reviewed patches have been landed.  Closing bug.