[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/tests
From:       David Faure <faure () kde ! org>
Date:       2010-09-22 17:18:06
Message-ID: 20100922171806.C5F14AC888 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1178306 by dfaure:

Fix unittest, which expected wrongly that QTextEdit/QTextDocument would use the \
palette. But they don't. Testcase: http://www.davidfaure.fr/2010/richtextedit.ui
So I guess the test broke after the default palette (coming from KGlobalSettings) \
didn't use Qt::black as text color.
CCMAIL: mcguire@kde.org


 M  +8 -4      krichtextedittest.cpp  


--- trunk/KDE/kdelibs/kdeui/tests/krichtextedittest.cpp #1178305:1178306
@@ -61,6 +61,10 @@
     // Add text, apply initial formatting, and add a link
     QTextCursor cursor = edit.textCursor();
     cursor.insertText(QString("Test"));
+    QTextCharFormat charFormat = cursor.charFormat();
+    // Note that QTextEdit doesn't use the palette. Black is black.
+    QCOMPARE(charFormat.foreground().color().name(), QColor(Qt::black).name());
+
     cursor.select(QTextCursor::BlockUnderCursor);
     edit.setTextCursor(cursor);
     edit.setTextBold(true);
@@ -75,10 +79,10 @@
     QCOMPARE(edit.fontItalic(), true);
     QCOMPARE(edit.fontWeight(), static_cast<int>(QFont::Bold));
     QCOMPARE(edit.fontUnderline(), true);
-    QTextCharFormat charFormat = cursor.charFormat();
+    charFormat = cursor.charFormat();
+    QCOMPARE(charFormat.foreground(), QBrush(KColorScheme(QPalette::Active, \
                KColorScheme::View).foreground(KColorScheme::LinkText).color()));
     QCOMPARE(charFormat.underlineColor(), KColorScheme(QPalette::Active, \
                KColorScheme::View).foreground(KColorScheme::LinkText).color());
     QCOMPARE(charFormat.underlineStyle(), QTextCharFormat::SingleUnderline);
-    QCOMPARE(charFormat.foreground(), QBrush(KColorScheme(QPalette::Active, \
KColorScheme::View).foreground(KColorScheme::LinkText).color()));  }
 
 void KRichTextEditTest::testUpdateLinkRemove()
@@ -108,7 +112,7 @@
     QCOMPARE(edit.fontWeight(), static_cast<int>(QFont::Bold));
     QCOMPARE(edit.fontUnderline(), false);
     QTextCharFormat charFormat = cursor.charFormat();
-    QCOMPARE(charFormat.underlineColor().name(), KColorScheme(QPalette::Active, \
KColorScheme::View).foreground().color().name()); +    \
QCOMPARE(charFormat.foreground().color().name(), QColor(Qt::black).name()); +    \
QCOMPARE(charFormat.underlineColor().name(), QColor(Qt::black).name());  \
                QCOMPARE(charFormat.underlineStyle(), QTextCharFormat::NoUnderline);
-    QCOMPARE(charFormat.foreground().color().name(), KColorScheme(QPalette::Active, \
KColorScheme::View).foreground().color().name());  }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic