Remove some QWidget autotest that have become irrelevant with -qpa.
We can't use windowing system specific checks on Lighthouse because the windowing system is now plugin-dependent.
This commit is contained in:
parent
d0beb0d95b
commit
bf8dfc394a
@ -210,10 +210,6 @@ private slots:
|
||||
void restoreVersion1Geometry_data();
|
||||
void restoreVersion1Geometry();
|
||||
|
||||
void windowTitle();
|
||||
void windowModified();
|
||||
void windowIconText();
|
||||
|
||||
void widgetAt();
|
||||
#ifdef Q_WS_MAC
|
||||
void retainHIView();
|
||||
@ -3379,249 +3375,6 @@ static CAknContextPane* ContextPane()
|
||||
}
|
||||
#endif
|
||||
|
||||
static QString visibleWindowTitle(QWidget *window, Qt::WindowState state = Qt::WindowNoState)
|
||||
{
|
||||
QString vTitle;
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
Q_UNUSED(state);
|
||||
const size_t maxTitleLength = 256;
|
||||
wchar_t title[maxTitleLength];
|
||||
GetWindowText(window->winId(), title, maxTitleLength);
|
||||
vTitle = QString::fromWCharArray(title);
|
||||
#elif defined(Q_WS_X11)
|
||||
/*
|
||||
We can't check what the window manager displays, but we can
|
||||
check what we tell the window manager to display. This will
|
||||
have to do.
|
||||
*/
|
||||
Atom UTF8_STRING = XInternAtom(window->x11Info().display(), "UTF8_STRING", false);
|
||||
Atom _NET_WM_NAME = XInternAtom(window->x11Info().display(), "_NET_WM_NAME", false);
|
||||
Atom _NET_WM_ICON_NAME = XInternAtom(window->x11Info().display(), "_NET_WM_ICON_NAME", false);
|
||||
uchar *data = 0;
|
||||
ulong length = 0;
|
||||
if (state == Qt::WindowMinimized) {
|
||||
if (getProperty(window->x11Info().display(), window->winId(),
|
||||
UTF8_STRING, _NET_WM_ICON_NAME, &data, &length)) {
|
||||
vTitle = QString::fromUtf8((char *) data, length);
|
||||
XFree(data);
|
||||
} else {
|
||||
XTextProperty text_prop;
|
||||
if (XGetWMIconName(window->x11Info().display(), window->winId(), &text_prop)) {
|
||||
vTitle = textPropertyToString(window->x11Info().display(), text_prop);
|
||||
XFree((char *) text_prop.value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (getProperty(window->x11Info().display(), window->winId(),
|
||||
UTF8_STRING, _NET_WM_NAME, &data, &length)) {
|
||||
vTitle = QString::fromUtf8((char *) data, length);
|
||||
XFree(data);
|
||||
} else {
|
||||
XTextProperty text_prop;
|
||||
if (XGetWMName(window->x11Info().display(), window->winId(), &text_prop)) {
|
||||
vTitle = textPropertyToString(window->x11Info().display(), text_prop);
|
||||
XFree((char *) text_prop.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif defined(Q_WS_MAC)
|
||||
vTitle = nativeWindowTitle(window, state);
|
||||
#elif defined(Q_WS_QWS)
|
||||
if (qwsServer) {
|
||||
const QWSWindow *win = 0;
|
||||
const QList<QWSWindow*> windows = qwsServer->clientWindows();
|
||||
for (int i = 0; i < windows.count(); ++i) {
|
||||
const QWSWindow* w = windows.at(i);
|
||||
if (w->winId() == window->winId()) {
|
||||
win = w;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (win)
|
||||
vTitle = win->caption();
|
||||
}
|
||||
#elif defined (Q_WS_S60)
|
||||
CAknTitlePane* titlePane = TitlePane();
|
||||
if(titlePane)
|
||||
{
|
||||
const TDesC* nTitle = titlePane->Text();
|
||||
vTitle = QString::fromUtf16(nTitle->Ptr(), nTitle->Length());
|
||||
}
|
||||
#endif
|
||||
|
||||
return vTitle;
|
||||
}
|
||||
|
||||
void tst_QWidget::windowTitle()
|
||||
{
|
||||
QWidget widget(0);
|
||||
widget.setWindowTitle("Application Name");
|
||||
widget.winId(); // Make sure the window is created...
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
|
||||
widget.setWindowTitle("Application Name *");
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name *"));
|
||||
|
||||
widget.setWindowTitle("Application Name[*]");
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
|
||||
widget.setWindowTitle("Application Name[*][*]");
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]"));
|
||||
|
||||
widget.setWindowTitle("Application Name[*][*][*]");
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]"));
|
||||
|
||||
widget.setWindowTitle("Application Name[*][*][*][*]");
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*][*]"));
|
||||
}
|
||||
|
||||
void tst_QWidget::windowIconText()
|
||||
{
|
||||
#ifdef Q_OS_SYMBIAN
|
||||
QSKIP("Symbian/S60 windows don't have window icon text", SkipAll);
|
||||
#endif
|
||||
QWidget widget(0);
|
||||
|
||||
widget.setWindowTitle("Application Name");
|
||||
widget.setWindowIconText("Application Minimized");
|
||||
widget.showNormal();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
widget.showMinimized();
|
||||
#if defined(Q_WS_QWS) || defined(Q_OS_WINCE)
|
||||
QEXPECT_FAIL(0, "Qt/Embedded/WinCE does not implement showMinimized()", Continue);
|
||||
//See task 147193 for WinCE
|
||||
#endif
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget, Qt::WindowMinimized),
|
||||
QString("Application Minimized"));
|
||||
|
||||
widget.setWindowTitle("Application Name[*]");
|
||||
widget.setWindowIconText("Application Minimized[*]");
|
||||
widget.showNormal();
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
widget.showMinimized();
|
||||
#if defined (Q_WS_QWS) || defined(Q_OS_WINCE)
|
||||
QEXPECT_FAIL(0, "Qt/Embedded/WinCE does not implement showMinimized()", Continue);
|
||||
//See task 147193 for WinCE
|
||||
#endif
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget, Qt::WindowMinimized),
|
||||
QString("Application Minimized"));
|
||||
|
||||
widget.setWindowModified(true);
|
||||
widget.showNormal();
|
||||
QApplication::instance()->processEvents();
|
||||
if (widget.style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, &widget))
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name*"));
|
||||
else
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
widget.showMinimized();
|
||||
#if defined (Q_WS_QWS) || defined(Q_OS_WINCE)
|
||||
QEXPECT_FAIL(0, "Qt/Embedded/WinCE does not implement showMinimized()", Continue);
|
||||
//See task 147193 for WinCE
|
||||
#endif
|
||||
QApplication::instance()->processEvents();
|
||||
#ifdef Q_WS_MAC
|
||||
QCOMPARE(visibleWindowTitle(&widget, Qt::WindowMinimized),
|
||||
QString("Application Minimized"));
|
||||
QVERIFY(nativeWindowModified(&widget));
|
||||
#else
|
||||
QCOMPARE(visibleWindowTitle(&widget, Qt::WindowMinimized),
|
||||
QString("Application Minimized*"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QWidget::windowModified()
|
||||
{
|
||||
QWidget widget(0);
|
||||
widget.show();
|
||||
QTest::qWaitForWindowShown(&widget);
|
||||
#ifndef Q_WS_MAC
|
||||
QTest::ignoreMessage(QtWarningMsg, "QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
|
||||
#endif
|
||||
widget.setWindowTitle("Application Name");
|
||||
QTest::qWait(10);
|
||||
QTRY_COMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
widget.setWindowModified(true);
|
||||
QVERIFY(nativeWindowModified(&widget));
|
||||
#else
|
||||
widget.setWindowModified(true);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
|
||||
widget.setWindowModified(false);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
|
||||
widget.setWindowTitle("Application Name[*]");
|
||||
|
||||
widget.setWindowModified(true);
|
||||
QApplication::instance()->processEvents();
|
||||
if (widget.style()->styleHint(QStyle::SH_TitleBar_ModifyNotification, 0, &widget))
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name*"));
|
||||
else
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
|
||||
widget.setWindowModified(false);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
|
||||
widget.setWindowTitle("Application[*] Name[*]");
|
||||
|
||||
widget.setWindowModified(true);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application* Name*"));
|
||||
|
||||
widget.setWindowModified(false);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name"));
|
||||
|
||||
widget.setWindowTitle("Application Name[*][*]");
|
||||
|
||||
widget.setWindowModified(true);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]"));
|
||||
|
||||
widget.setWindowModified(false);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]"));
|
||||
|
||||
widget.setWindowTitle("Application[*][*] Name[*][*]");
|
||||
|
||||
widget.setWindowModified(true);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application[*] Name[*]"));
|
||||
|
||||
widget.setWindowModified(false);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application[*] Name[*]"));
|
||||
|
||||
widget.setWindowTitle("Application[*] Name[*][*][*]");
|
||||
|
||||
widget.setWindowModified(true);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application* Name[*]*"));
|
||||
|
||||
widget.setWindowModified(false);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application Name[*]"));
|
||||
|
||||
widget.setWindowTitle("Application[*][*][*] Name[*][*][*]");
|
||||
|
||||
widget.setWindowModified(true);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application[*]* Name[*]*"));
|
||||
|
||||
widget.setWindowModified(false);
|
||||
QApplication::instance()->processEvents();
|
||||
QCOMPARE(visibleWindowTitle(&widget), QString("Application[*] Name[*]"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QWidget::task110173()
|
||||
{
|
||||
QWidget w;
|
||||
|
Loading…
Reference in New Issue
Block a user