forked from qt-creator/qt-creator
QtSupport: Fix output formatter test on dark systems
Change-Id: If511632de2be26899d2bea824b1a5de6ce1c4947 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -425,17 +425,21 @@ static QTextCharFormat blueFormat()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QTextCharFormat tweakedBlueFormat()
|
static QTextCharFormat tweakedFormat(QTextCharFormat format)
|
||||||
{
|
{
|
||||||
// foreground gets tweaked when passing doAppendMessage()
|
// foreground gets tweaked when passing doAppendMessage()
|
||||||
QTextCharFormat tweakedBlue = blueFormat();
|
QColor foreground = format.foreground().color();
|
||||||
QColor foreground = tweakedBlue.foreground().color();
|
const QColor background = format.hasProperty(QTextCharFormat::BackgroundBrush)
|
||||||
const QColor background = tweakedBlue.hasProperty(QTextCharFormat::BackgroundBrush)
|
? format.background().color()
|
||||||
? tweakedBlue.background().color()
|
|
||||||
: Utils::creatorColor(Theme::BackgroundColorNormal);
|
: Utils::creatorColor(Theme::BackgroundColorNormal);
|
||||||
foreground = StyleHelper::ensureReadableOn(background, foreground);
|
foreground = StyleHelper::ensureReadableOn(background, foreground);
|
||||||
tweakedBlue.setForeground(foreground);
|
format.setForeground(foreground);
|
||||||
return tweakedBlue;
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QTextCharFormat tweakedBlueFormat()
|
||||||
|
{
|
||||||
|
return tweakedFormat(blueFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QTextCharFormat greenFormat()
|
static QTextCharFormat greenFormat()
|
||||||
@@ -445,6 +449,11 @@ static QTextCharFormat greenFormat()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QTextCharFormat tweakedGreenFormat()
|
||||||
|
{
|
||||||
|
return tweakedFormat(greenFormat());
|
||||||
|
}
|
||||||
|
|
||||||
void QtOutputFormatterTest::testQtOutputFormatter_appendMessage_data()
|
void QtOutputFormatterTest::testQtOutputFormatter_appendMessage_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QString>("inputText");
|
QTest::addColumn<QString>("inputText");
|
||||||
@@ -518,7 +527,7 @@ void QtOutputFormatterTest::testQtOutputFormatter_appendMixedAssertAndAnsi()
|
|||||||
QCOMPARE(edit.toPlainText(), outputText);
|
QCOMPARE(edit.toPlainText(), outputText);
|
||||||
|
|
||||||
edit.moveCursor(QTextCursor::Start);
|
edit.moveCursor(QTextCursor::Start);
|
||||||
QCOMPARE(edit.currentCharFormat(), greenFormat());
|
QCOMPARE(edit.currentCharFormat(), tweakedGreenFormat());
|
||||||
|
|
||||||
edit.moveCursor(QTextCursor::WordRight);
|
edit.moveCursor(QTextCursor::WordRight);
|
||||||
edit.moveCursor(QTextCursor::Right);
|
edit.moveCursor(QTextCursor::Right);
|
||||||
|
Reference in New Issue
Block a user