summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/text')
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp25
-rw-r--r--tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp8
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp46
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp95
4 files changed, 92 insertions, 82 deletions
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index a949c91362..0c932e38a5 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -67,23 +67,17 @@ public slots:
void cleanup();
private slots:
void getSetCheck();
-#ifndef Q_WS_WIN
void exactMatch();
-#endif
void compare();
void resolve();
void resetFont();
void isCopyOf();
-#ifdef Q_WS_X11
void setFontRaw();
-#endif
void italicOblique();
void insertAndRemoveSubstitutions();
void serializeSpacing();
void lastResortFont();
-#if defined(Q_WS_MAC)
void styleName();
-#endif
#ifdef QT_BUILD_INTERNAL
void defaultFamily_data();
void defaultFamily();
@@ -148,8 +142,6 @@ void tst_QFont::cleanup()
// This will be executed immediately after each test is run.
}
-// Exact matching on windows misses a lot because of the sample chars.
-#ifndef Q_WS_WIN
void tst_QFont::exactMatch()
{
QFont font;
@@ -158,6 +150,10 @@ void tst_QFont::exactMatch()
font = QFont( "BogusFont", 33 );
QVERIFY( !font.exactMatch() );
+#ifdef Q_WS_WIN
+ QSKIP("Exact matching on windows misses a lot because of the sample chars");
+#endif
+
#ifdef Q_WS_X11
QVERIFY(QFont("sans").exactMatch());
QVERIFY(QFont("sans-serif").exactMatch());
@@ -305,7 +301,6 @@ void tst_QFont::exactMatch()
}
}
}
-#endif
void tst_QFont::italicOblique()
{
@@ -519,9 +514,11 @@ 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");
+#else
QFont f;
f.setRawName("-*-fixed-bold-r-normal--0-0-*-*-*-0-iso8859-1");
// qDebug("font family: %s", f.family().utf8());
@@ -538,8 +535,8 @@ void tst_QFont::setFontRaw()
if (!found)
QSKIP("Fixed font not available.");
QCOMPARE(QFontInfo(f).family().left(5).toLower(), QString("fixed"));
-}
#endif
+}
void tst_QFont::insertAndRemoveSubstitutions()
{
@@ -617,15 +614,17 @@ void tst_QFont::lastResortFont()
QVERIFY(!font.lastResortFont().isEmpty());
}
-#if defined(Q_WS_MAC)
void tst_QFont::styleName()
{
+#if !defined(Q_WS_MAC)
+ QSKIP("Only tested on Mac");
+#else
QFont font("Helvetica Neue");
font.setStyleName("UltraLight");
QCOMPARE(QFontInfo(font).styleName(), QString("UltraLight"));
-}
#endif
+}
#ifdef QT_BUILD_INTERNAL
Q_DECLARE_METATYPE(QFont::StyleHint)
diff --git a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
index c3b942f331..6886a687df 100644
--- a/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
+++ b/tests/auto/gui/text/qfontdatabase/tst_qfontdatabase.cpp
@@ -63,10 +63,8 @@ private slots:
void styles_data();
void styles();
-#ifndef Q_WS_QWS
void fixedPitch_data();
void fixedPitch();
-#endif
#ifdef Q_WS_MAC
void trickyFonts_data();
@@ -127,8 +125,6 @@ void tst_QFontDatabase::styles()
}
}
-// fixedPitch not implemented for Qtopia Core.
-#ifndef Q_WS_QWS
void tst_QFontDatabase::fixedPitch_data()
{
QTest::addColumn<QString>("font");
@@ -152,6 +148,9 @@ void tst_QFontDatabase::fixedPitch_data()
void tst_QFontDatabase::fixedPitch()
{
+#ifdef Q_WS_QWS
+ QSKIP("fixedPitch not implemented for Qtopia Core");
+#endif
QFETCH(QString, font);
QFETCH(bool, fixedPitch);
@@ -165,7 +164,6 @@ 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 0e1b3aaa1f..f1c2f6e4de 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -74,19 +74,13 @@ 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();
@@ -94,14 +88,10 @@ 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();
@@ -210,9 +200,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];
@@ -289,8 +279,10 @@ void tst_QTextLayout::lineBreaking()
QCOMPARE(b->breaks[i], (uchar)0xff);
++b;
}
-}
+#else
+ QSKIP("This test can not be run on non-X11 platforms");
#endif
+}
void tst_QTextLayout::simpleBoundingRect()
{
@@ -309,10 +301,11 @@ 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");
+#endif
/* stricter check. break text into three lines */
QString firstWord("hello");
@@ -364,7 +357,6 @@ void tst_QTextLayout::threeLineBoundingRect()
QCOMPARE(layout.boundingRect(), QRectF(0, 0, longestLine, y + 1));
}
-#endif
void tst_QTextLayout::boundingRectWithLongLineAndNoWrap()
{
@@ -428,10 +420,11 @@ 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");
+#endif
QString text = "ABCD";
QTextLayout layout(text, testFont);
@@ -468,12 +461,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");
+#endif
QString text = "AB CD";
QTextLayout layout(text, testFont);
@@ -494,7 +487,6 @@ void tst_QTextLayout::noWrap()
layout.endLayout();
}
-#endif
void tst_QTextLayout::cursorToXForInlineObjects()
{
@@ -614,10 +606,11 @@ 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");
+#endif
QString text = "FirstLine SecondLine";
text.replace('\n', QChar::LineSeparator);
@@ -638,7 +631,6 @@ void tst_QTextLayout::xToCursorAtEndOfLine()
line = layout.lineAt(1);
QCOMPARE(line.xToCursor(100000), 20);
}
-#endif
void tst_QTextLayout::boundingRectTopLeft()
{
@@ -676,10 +668,11 @@ 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");
+#endif
QString txt("Hello there\tworld");
QTextLayout layout(txt, testFont);
layout.beginLayout();
@@ -696,7 +689,6 @@ 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 0149a0a0a0..55ad866874 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -90,7 +90,6 @@ public slots:
void init();
void cleanup();
private slots:
-#ifdef Q_WS_X11
void devanagari();
void bengali();
void gurmukhi();
@@ -106,15 +105,10 @@ 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;
@@ -204,9 +198,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");
@@ -312,12 +306,14 @@ void tst_QTextScriptEngine::devanagari()
} else
QSKIP("couldn't find mangal");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::bengali()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -561,12 +557,14 @@ void tst_QTextScriptEngine::bengali()
} else
QSKIP("couldn't find Likhan");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::gurmukhi()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -588,12 +586,14 @@ void tst_QTextScriptEngine::gurmukhi()
} else
QSKIP("couldn't find Lohit Punjabi");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::oriya()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -626,13 +626,15 @@ void tst_QTextScriptEngine::oriya()
}
} else
QSKIP("couldn't find utkal");
- }
-}
+ }
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::tamil()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -703,12 +705,14 @@ void tst_QTextScriptEngine::tamil()
} else
QSKIP("couldn't find AkrutiTml1");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::telugu()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -750,12 +754,14 @@ void tst_QTextScriptEngine::telugu()
} else
QSKIP("couldn't find Pothana2000");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::kannada()
{
+#if defined(Q_WS_X11)
{
if (QFontDatabase().families(QFontDatabase::Kannada).contains("Sampige")) {
QFont f("Sampige");
@@ -823,12 +829,14 @@ void tst_QTextScriptEngine::kannada()
} else
QSKIP("couldn't find Tunga");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::malayalam()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -909,12 +917,14 @@ void tst_QTextScriptEngine::malayalam()
} else
QSKIP("couldn't find Rachana");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::sinhala()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -946,12 +956,14 @@ void tst_QTextScriptEngine::sinhala()
} else
QSKIP("couldn't find Malithi Web");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::khmer()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -989,12 +1001,14 @@ void tst_QTextScriptEngine::khmer()
} else
QSKIP("couldn't find Khmer OS");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
-#ifdef Q_WS_X11
void tst_QTextScriptEngine::linearB()
{
+#if defined(Q_WS_X11)
if (!haveTestFonts)
QSKIP("Test fonts are not available");
@@ -1016,8 +1030,10 @@ void tst_QTextScriptEngine::linearB()
} else
QSKIP("couldn't find Penuturesu");
}
-}
+#else
+ QSKIP("X11 specific test");
#endif
+}
#if defined(Q_WS_X11)
static bool decomposedShaping( const QFont &f, const QChar &ch)
@@ -1066,9 +1082,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");
@@ -1124,12 +1140,14 @@ void tst_QTextScriptEngine::greek()
} else
QSKIP("couldn't find SBL_grk");
}
-}
+#else
+ QSKIP("X11 specific test");
#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));
@@ -1143,10 +1161,11 @@ 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");
#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)
@@ -1182,11 +1201,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");
#endif
}
-#endif
-#ifndef Q_WS_MAC
void tst_QTextScriptEngine::mirroredChars_data()
{
QTest::addColumn<int>("hintingPreference");
@@ -1199,6 +1218,9 @@ void tst_QTextScriptEngine::mirroredChars_data()
void tst_QTextScriptEngine::mirroredChars()
{
+#if defined(Q_WS_MAC)
+ QSKIP("Not supported on Mac");
+#endif
QFETCH(int, hintingPreference);
QFont font;
@@ -1240,7 +1262,6 @@ void tst_QTextScriptEngine::mirroredChars()
QCOMPARE(glyphLayout.glyphs[1], leftParenthesis);
}
}
-#endif
QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"