Allow " in QQuickStyledText
authorJohn Brooks <john.brooks@jollamobile.com>
Thu, 24 Oct 2013 02:56:08 +0000 (20:56 -0600)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 24 Oct 2013 08:04:12 +0000 (10:04 +0200)
QString::toHtmlEscaped generates &quot;. QQuickStyledText should be
symmetrical with that function.

Change-Id: I67ea0abe446b5fa1edb53258dca58b84af910e28
Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
src/quick/util/qquickstyledtext.cpp
tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp

index b8f3ecf..f2b2d2a 100644 (file)
@@ -548,6 +548,8 @@ void QQuickStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textI
                 textOut += QChar(60);
             else if (entity == QLatin1String("amp"))
                 textOut += QChar(38);
+            else if (entity == QLatin1String("quot"))
+                textOut += QChar(34);
             return;
         }
         ++entityLength;
index 9351919..4e9ceba 100644 (file)
@@ -119,7 +119,7 @@ void tst_qquickstyledtext::textOutput_data()
     QTest::newRow("font bad 2") << "<font size=\"1>text</font>" << "" << FormatList() << false;
     QTest::newRow("extra close") << "<b>text</b></b>" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
     QTest::newRow("extra space") << "<b >text</b>" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
-    QTest::newRow("entities") << "&lt;b&gt;this &amp; that&lt;/b&gt;" << "<b>this & that</b>" << FormatList() << false;
+    QTest::newRow("entities") << "&lt;b&gt;&quot;this&quot; &amp; that&lt;/b&gt;" << "<b>\"this\" & that</b>" << FormatList() << false;
     QTest::newRow("newline") << "text<br>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;
     QTest::newRow("self-closing newline") << "text<br/>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;
     QTest::newRow("paragraph") << "text<p>more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") << FormatList() << false;