summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp15
-rw-r--r--tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp6
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index 5d73764..81e064e 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -71,6 +71,7 @@ private slots:
void elidedText();
void veryNarrowElidedText();
void averageCharWidth();
+ void bypassShaping();
void elidedMultiLength();
void elidedMultiLengthF();
void bearingIncludedInBoundingRect();
@@ -219,6 +220,20 @@ void tst_QFontMetrics::averageCharWidth()
QVERIFY(fmf.averageCharWidth() != 0);
}
+void tst_QFontMetrics::bypassShaping()
+{
+ QFont f;
+ QFontMetrics fm(f);
+ QString text = " A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z";
+ int textWidth = fm.width(text, -1, Qt::TextBypassShaping);
+ QVERIFY(textWidth != 0);
+ int charsWidth = 0;
+ for (int i = 0; i < text.size(); ++i)
+ charsWidth += fm.width(text[i]);
+ // This assertion is needed in QtWebKit's WebCore::Font::offsetForPositionForSimpleText
+ QCOMPARE(textWidth, charsWidth);
+}
+
template<class FontMetrics> void elidedMultiLength_helper()
{
QString text1 = "Long Text 1\x9cShorter\x9csmall";
diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
index 5854ae1..72d8eda 100644
--- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
+++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp
@@ -693,6 +693,12 @@ void tst_QNetworkCookie::parseMultipleCookies_data()
cookieA.setPath("/foo");
list = QList<QNetworkCookie>() << cookieA << cookieB;
QTest::newRow("real-3") << "a=b; expires=Mar 10 07:00:00 2009 GMT, Tue; path=/foo\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list;
+
+ // do not accept cookies with non-alphanumeric characters in domain field (QTBUG-11029)
+ cookie = QNetworkCookie("NonAlphNumDomName", "NonAlphNumDomValue");
+ cookie.setDomain("!@#$%^&*();:."); // the ';' is actually problematic, because it is a separator
+ list = QList<QNetworkCookie>();
+ QTest::newRow("domain-non-alpha-numeric") << "NonAlphNumDomName=NonAlphNumDomValue; domain=!@#$%^&*()" << list;
}
void tst_QNetworkCookie::parseMultipleCookies()