summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2009-11-04 04:55:29 (GMT)
committerBea Lam <bea.lam@nokia.com>2009-11-04 04:55:29 (GMT)
commit6225455eb1309ae5f1b441e1d4e8b4db547eb9b0 (patch)
tree94a8871b300db640c0a0cdcafe925933a3189c8b
parent537873f8bcbf1c3055c0edd59914d67539b0af52 (diff)
parenta5e66c8c02db19a26fcb8378a1d61302ad2d2c5f (diff)
downloadQt-6225455eb1309ae5f1b441e1d4e8b4db547eb9b0.zip
Qt-6225455eb1309ae5f1b441e1d4e8b4db547eb9b0.tar.gz
Qt-6225455eb1309ae5f1b441e1d4e8b4db547eb9b0.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--examples/declarative/animations/color-animation.qml5
-rw-r--r--tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp257
2 files changed, 226 insertions, 36 deletions
diff --git a/examples/declarative/animations/color-animation.qml b/examples/declarative/animations/color-animation.qml
index edb0659..54608c7 100644
--- a/examples/declarative/animations/color-animation.qml
+++ b/examples/declarative/animations/color-animation.qml
@@ -31,10 +31,7 @@ Item {
Item {
width: parent.width; height: 2 * parent.height
transformOrigin: Item.Center
- rotation: SequentialAnimation {
- running: true; repeat: true
- NumberAnimation { from: 0; to: 360; duration: 10000 }
- }
+ rotation: NumberAnimation { from: 0; to: 360; duration: 10000; running: true; repeat: true }
Image {
source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter
transformOrigin: Item.Center; rotation: -3 * parent.rotation
diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
index 1a90575..3e86cab 100644
--- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
+++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp
@@ -43,6 +43,7 @@
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlcomponent.h>
#include <private/qmlgraphicstext_p.h>
+#include <private/qmlvaluetype_p.h>
#include <QFontMetrics>
class tst_qmlgraphicstext : public QObject
@@ -67,6 +68,15 @@ private slots:
void color();
void smooth();
+ // QmlFontValueType
+ void weight();
+ void underline();
+ void overline();
+ void strikeout();
+ void capitalization();
+ void letterSpacing();
+ void wordSpacing();
+
private:
QStringList standard;
QStringList richText;
@@ -88,54 +98,54 @@ private:
tst_qmlgraphicstext::tst_qmlgraphicstext()
{
standard << "the quick brown fox jumped over the lazy dog"
- << "the quick brown fox\n jumped over the lazy dog";
+ << "the quick brown fox\n jumped over the lazy dog";
richText << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a> jumped over the <b>lazy</b> dog</i>"
- << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>";
+ << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>";
horizontalAlignmentmentStrings << "AlignLeft"
- << "AlignRight"
- << "AlignHCenter";
+ << "AlignRight"
+ << "AlignHCenter";
verticalAlignmentmentStrings << "AlignTop"
- << "AlignBottom"
- << "AlignVCenter";
+ << "AlignBottom"
+ << "AlignVCenter";
horizontalAlignmentments << Qt::AlignLeft
- << Qt::AlignRight
- << Qt::AlignHCenter;
+ << Qt::AlignRight
+ << Qt::AlignHCenter;
verticalAlignmentments << Qt::AlignTop
- << Qt::AlignBottom
- << Qt::AlignVCenter;
+ << Qt::AlignBottom
+ << Qt::AlignVCenter;
styleStrings << "Normal"
- << "Outline"
- << "Raised"
- << "Sunken";
+ << "Outline"
+ << "Raised"
+ << "Sunken";
styles << QmlGraphicsText::Normal
- << QmlGraphicsText::Outline
- << QmlGraphicsText::Raised
- << QmlGraphicsText::Sunken;
+ << QmlGraphicsText::Outline
+ << QmlGraphicsText::Raised
+ << QmlGraphicsText::Sunken;
colorStrings << "aliceblue"
- << "antiquewhite"
- << "aqua"
- << "darkkhaki"
- << "darkolivegreen"
- << "dimgray"
- << "palevioletred"
- << "lightsteelblue"
- << "#000000"
- << "#AAAAAA"
- << "#FFFFFF"
- << "#2AC05F";
- //
- // need a different test to do alpha channel test
- // << "#AA0011DD"
- // << "#00F16B11";
- //
+ << "antiquewhite"
+ << "aqua"
+ << "darkkhaki"
+ << "darkolivegreen"
+ << "dimgray"
+ << "palevioletred"
+ << "lightsteelblue"
+ << "#000000"
+ << "#AAAAAA"
+ << "#FFFFFF"
+ << "#2AC05F";
+ //
+ // need a different test to do alpha channel test
+ // << "#AA0011DD"
+ // << "#00F16B11";
+ //
}
void tst_qmlgraphicstext::text()
@@ -353,6 +363,8 @@ void tst_qmlgraphicstext::verticalAlignment()
QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }";
QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
}
}
@@ -365,6 +377,7 @@ void tst_qmlgraphicstext::verticalAlignment()
QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+ QVERIFY(textObject != 0);
QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
}
}
@@ -528,6 +541,186 @@ void tst_qmlgraphicstext::smooth()
}
}
+void tst_qmlgraphicstext::weight()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().weight(), (int)QmlFontValueType::Normal);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().weight(), (int)QmlFontValueType::Bold);
+ }
+}
+
+void tst_qmlgraphicstext::underline()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().underline(), false);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().underline(), true);
+ }
+}
+
+void tst_qmlgraphicstext::overline()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().overline(), false);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().overline(), true);
+ }
+}
+
+void tst_qmlgraphicstext::strikeout()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().strikeOut(), false);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().strikeOut(), true);
+ }
+}
+
+void tst_qmlgraphicstext::capitalization()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::MixedCase);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::AllUppercase);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::AllLowercase);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::SmallCaps);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::Capitalize);
+ }
+}
+
+void tst_qmlgraphicstext::letterSpacing()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), 0.0);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), -50.);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().letterSpacing(), 200.);
+ }
+}
+
+void tst_qmlgraphicstext::wordSpacing()
+{
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), 0.0);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), -50.);
+ }
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->font().wordSpacing(), 200.);
+ }
+}
+
QTEST_MAIN(tst_qmlgraphicstext)
#include "tst_qmlgraphicstext.moc"