Skip to content

Commit

Permalink
Shrink unsuported renderer overlay so test can access valid image data
Browse files Browse the repository at this point in the history
quickinspectortext was failing on windows because the overlay that
states "DirectX is not supported yet, please use OpenGL or Software
backend" dims color values, making color compare fail. A solution
for this is to make this overlay a little smaller, so we can get a
glimpse of the original colors from the corners we pick colors from
in this test.
  • Loading branch information
Cuperino committed May 3, 2024
1 parent b942588 commit bd3928f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/quickinspector/quickscreengrabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,15 @@ void UnsupportedScreenGrabber::requestGrabWindow(const QRectF & /*userViewport*/
p.setRenderHint(QPainter::TextAntialiasing);
QColor gray(Qt::black);
gray.setAlpha(alpha);
p.fillRect(QRect(QPoint {}, m_window->size()), gray);
auto textBoxRect = QRect(QPoint(4, 4), m_window->size() - QSize(8, 8));
p.fillRect(textBoxRect, gray);
p.setPen(Qt::white);
auto font = qApp->font();
font.setPointSize(font.pointSize() + 1);
p.setFont(font);
QString backend = VariantHandler::displayString(QVariant::fromValue(m_window->graphicsApi()));
QString txt = backend + QStringLiteral(" is not supported yet, please use OpenGL or Software backend");
p.drawText(QRect { QPoint(0, 0), m_window->size() }, Qt::AlignCenter | Qt::TextWordWrap, txt);
p.drawText(textBoxRect, Qt::AlignCenter | Qt::TextWordWrap, txt);

emit sceneGrabbed(m_grabbedFrame);
}
Expand Down

0 comments on commit bd3928f

Please sign in to comment.