summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-09-30 13:19:21 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-03 03:34:57 +0200
commit0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b (patch)
tree33c67e6b261357b5bd4a180e13bb48d26da5ca16 /tests/auto/gui/text
parent3c54bd67dacc2a5d11246213377e804be364a387 (diff)
Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: I31e069f5476f8adf9851e94b33c6afac4394b88e Reviewed-on: http://codereview.qt-project.org/5824 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/gui/text')
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp28
-rw-r--r--tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp8
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp47
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp99
4 files changed, 83 insertions, 99 deletions
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index a564e71e19..48d0e438f3 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -72,12 +72,18 @@ private slots:
void resolve();
void resetFont();
void isCopyOf();
+#ifdef Q_WS_X11
void setFontRaw();
+#endif
void italicOblique();
void insertAndRemoveSubstitutions();
void serializeSpacing();
+#if !defined(Q_WS_QWS) && !defined(Q_WS_QPA)
void lastResortFont();
+#endif
+#if defined(Q_WS_MAC)
void styleName();
+#endif
};
// Testing get/set functions
@@ -512,11 +518,9 @@ void tst_QFont::isCopyOf()
QVERIFY(!font3.isCopyOf(font));
}
+#ifdef Q_WS_X11
void tst_QFont::setFontRaw()
{
-#ifndef Q_WS_X11
- QSKIP("Only tested on X11", SkipAll);
-#else
QFont f;
f.setRawName("-*-fixed-bold-r-normal--0-0-*-*-*-0-iso8859-1");
// qDebug("font family: %s", f.family().utf8());
@@ -534,8 +538,8 @@ void tst_QFont::setFontRaw()
QSKIP("Fixed font not available.", SkipSingle);
}
QCOMPARE(QFontInfo(f).family().left(5).toLower(), QString("fixed"));
-#endif
}
+#endif
void tst_QFont::insertAndRemoveSubstitutions()
{
@@ -602,28 +606,26 @@ void tst_QFont::serializeSpacing()
QCOMPARE(font3.wordSpacing(), 50.);
}
+// QFont::lastResortFont() may abort with qFatal() on QWS/QPA
+// if absolutely no font is found. Just as ducumented for QFont::lastResortFont().
+// This happens on our CI machines which run QWS autotests.
+#if !defined(Q_WS_QWS) && !defined(Q_WS_QPA)
void tst_QFont::lastResortFont()
{
-#if defined(Q_WS_QWS) || defined(Q_WS_QPA)
- QSKIP("QFont::lastResortFont() may abort with qFatal() on QWS/QPA", SkipAll);
- // ...if absolutely no font is found. Just as ducumented for QFont::lastResortFont().
- // This happens on our CI machines which run QWS autotests.
-#endif
QFont font;
QVERIFY(!font.lastResortFont().isEmpty());
}
+#endif
+#if defined(Q_WS_MAC)
void tst_QFont::styleName()
{
-#if !defined(Q_WS_MAC)
- QSKIP("Only tested on Mac", SkipAll);
-#else
QFont font("Helvetica Neue");
font.setStyleName("UltraLight");
QCOMPARE(QFontInfo(font).styleName(), QString("UltraLight"));
-#endif
}
+#endif
QTEST_MAIN(tst_QFont)
#include "tst_qfont.moc"
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
index 052b4d4bd0..fe37c77dd5 100644
--- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
@@ -63,8 +63,10 @@ private slots:
void styles_data();
void styles();
+#ifndef Q_WS_QWS
void fixedPitch_data();
void fixedPitch();
+#endif
#ifdef Q_WS_MAC
void trickyFonts_data();
@@ -125,6 +127,8 @@ void tst_QFontDatabase::styles()
}
}
+// fixedPitch not implemented for Qtopia Core.
+#ifndef Q_WS_QWS
void tst_QFontDatabase::fixedPitch_data()
{
QTest::addColumn<QString>("font");
@@ -148,9 +152,6 @@ void tst_QFontDatabase::fixedPitch_data()
void tst_QFontDatabase::fixedPitch()
{
-#ifdef Q_WS_QWS
- QSKIP("fixedPitch not implemented for Qtopia Core", SkipAll);
-#endif
QFETCH(QString, font);
QFETCH(bool, fixedPitch);
@@ -164,6 +165,7 @@ void tst_QFontDatabase::fixedPitch()
QFontInfo fi(qfont);
QCOMPARE(fi.fixedPitch(), fixedPitch);
}
+#endif
#ifdef Q_WS_MAC
void tst_QFontDatabase::trickyFonts_data()
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index 2414ab3e37..8b6b51b2da 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -74,13 +74,19 @@ public slots:
void cleanup();
private slots:
void getSetCheck();
+#ifdef Q_WS_X11
void lineBreaking();
+#endif
void simpleBoundingRect();
+#ifndef Q_WS_MAC
void threeLineBoundingRect();
+#endif
void boundingRectWithLongLineAndNoWrap();
void forcedBreaks();
+#ifndef Q_WS_MAC
void breakAny();
void noWrap();
+#endif
void cursorToXForInlineObjects();
void cursorToXForSetColumns();
void defaultWordSeparators_data();
@@ -88,10 +94,14 @@ private slots:
void cursorMovementFromInvalidPositions();
void cursorMovementInsideSpaces();
void charWordStopOnLineSeparator();
+#ifndef Q_WS_MAC
void xToCursorAtEndOfLine();
+#endif
void boundingRectTopLeft();
void charStopForSurrogatePairs();
+#ifndef Q_WS_MAC
void tabStops();
+#endif
void integerOverflow();
void testDefaultTabs();
void testTabs();
@@ -199,10 +209,9 @@ void tst_QTextLayout::cleanup()
testFont = QFont();
}
-
+#ifdef Q_WS_X11
void tst_QTextLayout::lineBreaking()
{
-#if defined(Q_WS_X11)
struct Breaks {
const char *utf8;
uchar breaks[32];
@@ -279,10 +288,8 @@ void tst_QTextLayout::lineBreaking()
QCOMPARE(b->breaks[i], (uchar)0xff);
++b;
}
-#else
- QSKIP("This test can not be run on non-X11 platforms", SkipAll);
-#endif
}
+#endif
void tst_QTextLayout::simpleBoundingRect()
{
@@ -301,11 +308,10 @@ void tst_QTextLayout::simpleBoundingRect()
QCOMPARE(layout.boundingRect(), QRectF(0, 0, width, QFontMetrics(testFont).height()));
}
+// QTestFontEngine on the mac does not support logclusters at the moment.
+#ifndef Q_WS_MAC
void tst_QTextLayout::threeLineBoundingRect()
{
-#if defined(Q_WS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment", SkipAll);
-#endif
/* stricter check. break text into three lines */
QString firstWord("hello");
@@ -357,6 +363,7 @@ void tst_QTextLayout::threeLineBoundingRect()
QCOMPARE(layout.boundingRect(), QRectF(0, 0, longestLine, y + 1));
}
+#endif
void tst_QTextLayout::boundingRectWithLongLineAndNoWrap()
{
@@ -420,11 +427,10 @@ void tst_QTextLayout::forcedBreaks()
QCOMPARE(line.xToCursor(0), line.textStart());
}
+// QTestFontEngine on the mac does not support logclusters at the moment.
+#ifndef Q_WS_MAC
void tst_QTextLayout::breakAny()
{
-#if defined(Q_WS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment", SkipAll);
-#endif
QString text = "ABCD";
QTextLayout layout(text, testFont);
@@ -461,12 +467,12 @@ void tst_QTextLayout::breakAny()
layout.endLayout();
}
+#endif
+// QTestFontEngine on the mac does not support logclusters at the moment.
+#ifndef Q_WS_MAC
void tst_QTextLayout::noWrap()
{
-#if defined(Q_WS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment", SkipAll);
-#endif
QString text = "AB CD";
QTextLayout layout(text, testFont);
@@ -487,6 +493,7 @@ void tst_QTextLayout::noWrap()
layout.endLayout();
}
+#endif
void tst_QTextLayout::cursorToXForInlineObjects()
{
@@ -606,11 +613,10 @@ void tst_QTextLayout::charWordStopOnLineSeparator()
QVERIFY(attrs[1].charStop);
}
+// QTestFontEngine on the mac does not support logclusters at the moment.
+#ifndef Q_WS_MAC
void tst_QTextLayout::xToCursorAtEndOfLine()
{
-#if defined(Q_WS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment", SkipAll);
-#endif
QString text = "FirstLine SecondLine";
text.replace('\n', QChar::LineSeparator);
@@ -631,6 +637,7 @@ void tst_QTextLayout::xToCursorAtEndOfLine()
line = layout.lineAt(1);
QCOMPARE(line.xToCursor(100000), 20);
}
+#endif
void tst_QTextLayout::boundingRectTopLeft()
{
@@ -668,11 +675,10 @@ void tst_QTextLayout::charStopForSurrogatePairs()
QVERIFY(attrs[3].charStop);
}
+// QTestFontEngine on the mac does not support logclusters at the moment.
+#ifndef Q_WS_MAC
void tst_QTextLayout::tabStops()
{
-#if defined(Q_WS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment", SkipAll);
-#endif
QString txt("Hello there\tworld");
QTextLayout layout(txt, testFont);
layout.beginLayout();
@@ -689,6 +695,7 @@ void tst_QTextLayout::tabStops()
layout.endLayout();
}
+#endif
void tst_QTextLayout::integerOverflow()
{
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index cbed675cb7..7f30009e56 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -90,6 +90,7 @@ public slots:
void init();
void cleanup();
private slots:
+#ifdef Q_WS_X11
void devanagari();
void bengali();
void gurmukhi();
@@ -105,10 +106,15 @@ private slots:
void khmer();
void linearB();
void controlInSyllable_qtbug14204();
+#endif
+#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11)
void combiningMarks_qtbug15675();
+#endif
+#ifndef Q_WS_MAC
void mirroredChars_data();
void mirroredChars();
+#endif
private:
bool haveTestFonts;
@@ -198,9 +204,9 @@ static bool shaping( const QFont &f, const ShapeTable *s)
}
#endif
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::devanagari()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -309,14 +315,12 @@ void tst_QTextScriptEngine::devanagari()
QSKIP("couldn't find mangal", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::bengali()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -564,14 +568,12 @@ void tst_QTextScriptEngine::bengali()
QSKIP("couldn't find Likhan", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::gurmukhi()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -595,12 +597,12 @@ void tst_QTextScriptEngine::gurmukhi()
QSKIP("couldn't find Lohit Punjabi", SkipAll);
}
}
-#endif
}
+#endif
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::oriya()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -636,15 +638,12 @@ void tst_QTextScriptEngine::oriya()
QSKIP("couldn't find utkal", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
-
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::tamil()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -717,15 +716,12 @@ void tst_QTextScriptEngine::tamil()
QSKIP("couldn't find AkrutiTml1", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
-
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::telugu()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -769,15 +765,12 @@ void tst_QTextScriptEngine::telugu()
QSKIP("couldn't find Pothana2000", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
-
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::kannada()
{
-#if defined(Q_WS_X11)
{
if (QFontDatabase().families(QFontDatabase::Kannada).contains("Sampige")) {
QFont f("Sampige");
@@ -847,16 +840,12 @@ void tst_QTextScriptEngine::kannada()
QSKIP("couldn't find Tunga", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
-
-
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::malayalam()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -940,15 +929,12 @@ void tst_QTextScriptEngine::malayalam()
QSKIP("couldn't find Rachana", SkipAll);
}
}
-
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::sinhala()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -982,15 +968,12 @@ void tst_QTextScriptEngine::sinhala()
QSKIP("couldn't find Malithi Web", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
-
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::khmer()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -1030,14 +1013,12 @@ void tst_QTextScriptEngine::khmer()
QSKIP("couldn't find Khmer OS", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::linearB()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -1061,10 +1042,8 @@ void tst_QTextScriptEngine::linearB()
QSKIP("couldn't find Penuturesu", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
#if defined(Q_WS_X11)
static bool decomposedShaping( const QFont &f, const QChar &ch)
@@ -1113,10 +1092,9 @@ static bool decomposedShaping( const QFont &f, const QChar &ch)
}
#endif
-
+#ifdef Q_WS_X11
void tst_QTextScriptEngine::greek()
{
-#if defined(Q_WS_X11)
if (!haveTestFonts) {
QSKIP("Test fonts are not available", SkipAll);
}
@@ -1175,14 +1153,12 @@ void tst_QTextScriptEngine::greek()
QSKIP("couldn't find SBL_grk", SkipAll);
}
}
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
+#if defined(Q_WS_X11)
void tst_QTextScriptEngine::controlInSyllable_qtbug14204()
{
-#if defined(Q_WS_X11)
QString s;
s.append(QChar(0x0915));
s.append(QChar(0x094d));
@@ -1196,11 +1172,10 @@ void tst_QTextScriptEngine::controlInSyllable_qtbug14204()
QVERIFY(e->layoutData->items[0].num_glyphs == 2);
QVERIFY(e->layoutData->glyphLayout.advances_x[1] != 0);
-#else
- QSKIP("X11 specific test", SkipAll);
-#endif
}
+#endif
+#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11)
void tst_QTextScriptEngine::combiningMarks_qtbug15675()
{
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
@@ -1238,11 +1213,11 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675()
QVERIFY(e->layoutData->items[0].num_glyphs == 3);
QVERIFY(e->layoutData->glyphLayout.advances_x[1] == 0);
-#else
- QSKIP("X11/Mac specific test", SkipAll);
#endif
}
+#endif
+#ifndef Q_WS_MAC
void tst_QTextScriptEngine::mirroredChars_data()
{
QTest::addColumn<int>("hintingPreference");
@@ -1255,9 +1230,6 @@ void tst_QTextScriptEngine::mirroredChars_data()
void tst_QTextScriptEngine::mirroredChars()
{
-#if defined(Q_WS_MAC)
- QSKIP("Not supported on Mac", SkipAll);
-#endif
QFETCH(int, hintingPreference);
QFont font;
@@ -1299,6 +1271,7 @@ void tst_QTextScriptEngine::mirroredChars()
QCOMPARE(glyphLayout.glyphs[1], leftParenthesis);
}
}
+#endif
QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"