2c3bbb9783
Unfortunately Qt triggers an ASAN error in it's opengl implementation. As we don't really need the visible output in the test, disable QML. While this is unfortunate, it's better than a false-positive failing test. Output from build.kde.org: 18:15:51 ================================================================= 18:15:51 ==13802==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x614000027640 in thread T0: 18:15:51 object passed to delete has wrong type: 18:15:51 size of the allocated type: 400 bytes; 18:15:51 size of the deallocated type: 16 bytes. 18:15:51 #0 0x7fc1632614b2 in operator delete(void*, unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9a4b2) 18:15:51 #1 0x7fc1624f947d in QOpenGLVersionFunctionsStorage::~QOpenGLVersionFunctionsStorage() opengl/qopenglversionfunctions.cpp:81 18:15:51 #2 0x7fc1621c1315 in QOpenGLContextPrivate::~QOpenGLContextPrivate() (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/qt5/inst/usr/lib/libQt5Gui.so.5+0x172315) 18:15:51 #3 0x7fc1621c1365 in QOpenGLContextPrivate::~QOpenGLContextPrivate() (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/qt5/inst/usr/lib/libQt5Gui.so.5+0x172365) 18:15:51 #4 0x7fc161701e93 in QScopedPointerDeleter<QObjectData>::cleanup(QObjectData*) (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/qt5/inst/usr/lib/libQt5Core.so.5+0x363e93) 18:15:51 #5 0x7fc1617002c0 in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer() ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:107 18:15:51 #6 0x7fc1616f4d20 in QObject::~QObject() kernel/qobject.cpp:900 18:15:51 #7 0x7fc1621beabf in QOpenGLContext::~QOpenGLContext() kernel/qopenglcontext.cpp:689 18:15:51 #8 0x7fc1621beaf3 in QOpenGLContext::~QOpenGLContext() kernel/qopenglcontext.cpp:696 18:15:51 #9 0x7fc162df817d in QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow*) scenegraph/qsgrenderloop.cpp:323 18:15:51 #10 0x7fc162e3ed8f in QQuickWindow::~QQuickWindow() items/qquickwindow.cpp:1237 18:15:51 #11 0x7fc151a105c1 in PlasmaQuick::Dialog::~Dialog() (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/frameworks/plasma-framework/inst/usr/lib/x86_64-linux-gnu/libKF5PlasmaQuick.so.5+0x1235c1) 18:15:51 #12 0x7fc151f4bce4 in QQmlPrivate::QQmlElement<PlasmaQuick::Dialog>::~QQmlElement() (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/frameworks/plasma-framework/inst/usr/lib/x86_64-linux-gnu/qml/org/kde/plasma/core/libcorebindingsplugin.so+0x162ce4) 18:15:51 #13 0x7fc151f4bd6d in QQmlPrivate::QQmlElement<PlasmaQuick::Dialog>::~QQmlElement() (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/frameworks/plasma-framework/inst/usr/lib/x86_64-linux-gnu/qml/org/kde/plasma/core/libcorebindingsplugin.so+0x162d6d) 18:15:51 #14 0x41f82f in QScopedPointerDeleter<QObject>::cleanup(QObject*) /srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/qt5/inst/usr/include/QtCore/qscopedpointer.h:60 18:15:51 #15 0x41e7a1 in QScopedPointer<QObject, QScopedPointerDeleter<QObject> >::~QScopedPointer() /srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/qt5/inst/usr/include/QtCore/qscopedpointer.h:107 18:15:51 #16 0x41c6b0 in KWin::OnScreenNotification::~OnScreenNotification() /home/jenkins/sources/kwin/kf5-qt5/onscreennotification.cpp:55 18:15:51 #17 0x410349 in OnScreenNotificationTest::show() /home/jenkins/sources/kwin/kf5-qt5/autotests/onscreennotificationtest.cpp:42 18:15:51 #18 0x42095f in OnScreenNotificationTest::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/sources/kwin/kf5-qt5/build/autotests/moc_onscreennotificationtest.cpp:80 18:15:51 #19 0x7fc1616c3bda in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const kernel/qmetaobject.cpp:2222 18:15:51 #20 0x7fc1642f776c in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/qt5/inst/usr/lib/libQt5Test.so.5+0x1c76c) 18:15:51 #21 0x7fc1642f0820 in QTest::TestMethods::invokeTestOnData(int) const /home/jenkins/sources/qt5/kf5-qt5/qtbase/src/testlib/qtestcase.cpp:800 18:15:51 #22 0x7fc1642f1353 in QTest::TestMethods::invokeTest(int, char const*, QTest::WatchDog*) const /home/jenkins/sources/qt5/kf5-qt5/qtbase/src/testlib/qtestcase.cpp:981 18:15:51 #23 0x7fc1642f25d6 in QTest::TestMethods::invokeTests(QObject*) const /home/jenkins/sources/qt5/kf5-qt5/qtbase/src/testlib/qtestcase.cpp:1314 18:15:51 #24 0x7fc1642f31f7 in QTest::qExec(QObject*, int, char**) /home/jenkins/sources/qt5/kf5-qt5/qtbase/src/testlib/qtestcase.cpp:1724 18:15:51 #25 0x40f5e4 in main /home/jenkins/sources/kwin/kf5-qt5/autotests/onscreennotificationtest.cpp:31 18:15:51 #26 0x7fc160a5babf in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20abf) 18:15:51 #27 0x40d118 in _start (/home/jenkins/sources/kwin/kf5-qt5/build/autotests/testOnScreenNotification+0x40d118) 18:15:51 18:15:51 0x614000027640 is located 0 bytes inside of 400-byte region [0x614000027640,0x6140000277d0) 18:15:51 allocated by thread T0 here: 18:15:51 #0 0x7fc1632608b2 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x998b2) 18:15:51 #1 0x7fc1624f9563 in QOpenGLVersionFunctionsStorage::backend(QOpenGLContext*, QOpenGLVersionFunctionsBackend::Version) opengl/qopenglversionfunctions.cpp:108 18:15:51 #2 0x7fc1624f9b10 in QAbstractOpenGLFunctionsPrivate::functionsBackend(QOpenGLContext*, QOpenGLVersionFunctionsBackend::Version) opengl/qopenglversionfunctions.cpp:122 18:15:51 #3 0x7fc16251475d in QOpenGLFunctions_1_0::initializeOpenGLFunctions() opengl/qopenglfunctions_1_0.cpp:100 18:15:51 #4 0x7fc1621bee83 in QOpenGLContext::versionFunctions(QOpenGLVersionProfile const&) const kernel/qopenglcontext.cpp:862 18:15:51 #5 0x7fc1621c1dbe in QOpenGLFunctions_1_0* QOpenGLContext::versionFunctions<QOpenGLFunctions_1_0>() const (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/qt5/inst/usr/lib/libQt5Gui.so.5+0x172dbe) 18:15:51 #6 0x7fc1621be166 in QOpenGLContextPrivate::maxTextureSize() kernel/qopenglcontext.cpp:382 18:15:51 #7 0x7fc1624df66a in QOpenGLTextureGlyphCache::maxTextureHeight() const opengl/qopengltextureglyphcache.cpp:459 18:15:51 #8 0x7fc162467acf in QTextureGlyphCache::populate(QFontEngine*, int, unsigned int const*, QFixedPoint const*) painting/qtextureglyphcache.cpp:208 18:15:51 #9 0x7fc162dddcfa in QSGTextMaskMaterial::populate(QPointF const&, QVector<unsigned int> const&, QVector<QPointF> const&, QSGGeometry*, QRectF*, QPointF*, QMargins const&) scenegraph/qsgdefaultglyphnode_p.cpp:456 18:15:51 #10 0x7fc162ddbc2b in QSGDefaultGlyphNode::update() scenegraph/qsgdefaultglyphnode.cpp:127 18:15:51 #11 0x7fc162ea3fb9 in QQuickTextNode::addGlyphs(QPointF const&, QGlyphRun const&, QColor const&, QQuickText::TextStyle, QColor const&, QSGNode*) items/qquicktextnode.cpp:115 18:15:51 #12 0x7fc162eaa7f6 in QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode*, QQuickText::TextStyle, QColor const&) items/qquicktextnodeengine.cpp:777 18:15:51 #13 0x7fc162ea4baa in QQuickTextNode::addTextLayout(QPointF const&, QTextLayout*, QColor const&, QQuickText::TextStyle, QColor const&, QColor const&, QColor const&, QColor const&, int, int, int, int) items/qquicktextnode.cpp:265 18:15:51 #14 0x7fc162ea02f9 in QQuickText::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) items/qquicktext.cpp:2304 18:15:51 #15 0x7fc162e48a5f in QQuickWindowPrivate::updateDirtyNode(QQuickItem*) items/qquickwindow.cpp:3104 18:15:51 #16 0x7fc162e476a5 in QQuickWindowPrivate::updateDirtyNodes() items/qquickwindow.cpp:2849 18:15:51 #17 0x7fc162e3a8d2 in QQuickWindowPrivate::syncSceneGraph() items/qquickwindow.cpp:419 18:15:51 #18 0x7fc162df86bc in QSGGuiThreadRenderLoop::renderWindow(QQuickWindow*) scenegraph/qsgrenderloop.cpp:391 18:15:51 #19 0x7fc162df8c95 in QSGGuiThreadRenderLoop::exposureChanged(QQuickWindow*) scenegraph/qsgrenderloop.cpp:442 18:15:51 #20 0x7fc162e39e45 in QQuickWindow::exposeEvent(QExposeEvent*) items/qquickwindow.cpp:216 18:15:51 #21 0x7fc16217600d in QWindow::event(QEvent*) kernel/qwindow.cpp:2105 18:15:51 #22 0x7fc162e3f69e in QQuickWindow::event(QEvent*) items/qquickwindow.cpp:1537 18:15:51 #23 0x7fc151a17911 in PlasmaQuick::Dialog::event(QEvent*) (/srv/jenkins/install/ubuntu/x86_64/g++/kf5-qt5/frameworks/plasma-framework/inst/usr/lib/x86_64-linux-gnu/libKF5PlasmaQuick.so.5+0x12a911) 18:15:51 #24 0x7fc1616b69a7 in QCoreApplicationPrivate::notify_helper(QObject*, QEvent*) kernel/qcoreapplication.cpp:1122 18:15:51 #25 0x7fc1616b65d1 in doNotify kernel/qcoreapplication.cpp:1063 18:15:51 #26 0x7fc1616b6535 in QCoreApplication::notify(QObject*, QEvent*) kernel/qcoreapplication.cpp:1049 18:15:51 #27 0x7fc1621623ef in QGuiApplication::notify(QObject*, QEvent*) kernel/qguiapplication.cpp:1648 18:15:51 #28 0x7fc1616b64b2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) kernel/qcoreapplication.cpp:988 18:15:51 #29 0x7fc16216ac69 in QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:234 18:15:51 18:15:51 SUMMARY: AddressSanitizer: new-delete-type-mismatch ??:0 operator delete(void*, unsigned long) 18:15:51 ==13802==HINT: if you don't care about these warnings you may set ASAN_OPTIONS=new_delete_type_mismatch=0 18:15:51 ==13802==ABORTING
123 lines
4.5 KiB
C++
123 lines
4.5 KiB
C++
/*
|
|
* Copyright 2016 Martin Graesslin <mgraesslin@kde.org>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; either version 2 of
|
|
* the License or (at your option) version 3 or any later version
|
|
* accepted by the membership of KDE e.V. (or its successor approved
|
|
* by the membership of KDE e.V.), which shall act as a proxy
|
|
* defined in Section 14 of version 3 of the license.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
#include "onscreennotificationtest.h"
|
|
#include "../onscreennotification.h"
|
|
|
|
#include <KSharedConfig>
|
|
#include <KConfigGroup>
|
|
|
|
#include <QQmlEngine>
|
|
#include <QSignalSpy>
|
|
#include <QTest>
|
|
|
|
QTEST_MAIN(OnScreenNotificationTest);
|
|
|
|
using KWin::OnScreenNotification;
|
|
|
|
void OnScreenNotificationTest::show()
|
|
{
|
|
OnScreenNotification notification;
|
|
auto config = KSharedConfig::openConfig(QString(), KSharedConfig::SimpleConfig);
|
|
KConfigGroup group = config->group("OnScreenNotification");
|
|
group.writeEntry(QStringLiteral("QmlPath"), QString("/does/not/exist.qml"));
|
|
group.sync();
|
|
notification.setConfig(config);
|
|
notification.setEngine(new QQmlEngine(¬ification));
|
|
notification.setMessage(QStringLiteral("Some text so that we see it in the test"));
|
|
|
|
QSignalSpy visibleChangedSpy(¬ification, &OnScreenNotification::visibleChanged);
|
|
QCOMPARE(notification.isVisible(), false);
|
|
notification.setVisible(true);
|
|
QCOMPARE(notification.isVisible(), true);
|
|
QCOMPARE(visibleChangedSpy.count(), 1);
|
|
|
|
// show again should not trigger
|
|
notification.setVisible(true);
|
|
QCOMPARE(visibleChangedSpy.count(), 1);
|
|
|
|
// timer should not have hidden
|
|
QTest::qWait(500);
|
|
QCOMPARE(notification.isVisible(), true);
|
|
|
|
// hide again
|
|
notification.setVisible(false);
|
|
QCOMPARE(notification.isVisible(), false);
|
|
QCOMPARE(visibleChangedSpy.count(), 2);
|
|
|
|
// now show with timer
|
|
notification.setTimeout(250);
|
|
notification.setVisible(true);
|
|
QCOMPARE(notification.isVisible(), true);
|
|
QCOMPARE(visibleChangedSpy.count(), 3);
|
|
QVERIFY(visibleChangedSpy.wait());
|
|
QCOMPARE(notification.isVisible(), false);
|
|
QCOMPARE(visibleChangedSpy.count(), 4);
|
|
}
|
|
|
|
void OnScreenNotificationTest::timeout()
|
|
{
|
|
OnScreenNotification notification;
|
|
QSignalSpy timeoutChangedSpy(¬ification, &OnScreenNotification::timeoutChanged);
|
|
QCOMPARE(notification.timeout(), 0);
|
|
notification.setTimeout(1000);
|
|
QCOMPARE(notification.timeout(), 1000);
|
|
QCOMPARE(timeoutChangedSpy.count(), 1);
|
|
notification.setTimeout(1000);
|
|
QCOMPARE(timeoutChangedSpy.count(), 1);
|
|
notification.setTimeout(0);
|
|
QCOMPARE(notification.timeout(), 0);
|
|
QCOMPARE(timeoutChangedSpy.count(), 2);
|
|
}
|
|
|
|
void OnScreenNotificationTest::iconName()
|
|
{
|
|
OnScreenNotification notification;
|
|
QSignalSpy iconNameChangedSpy(¬ification, &OnScreenNotification::iconNameChanged);
|
|
QVERIFY(iconNameChangedSpy.isValid());
|
|
QCOMPARE(notification.iconName(), QString());
|
|
notification.setIconName(QStringLiteral("foo"));
|
|
QCOMPARE(notification.iconName(), QStringLiteral("foo"));
|
|
QCOMPARE(iconNameChangedSpy.count(), 1);
|
|
notification.setIconName(QStringLiteral("foo"));
|
|
QCOMPARE(iconNameChangedSpy.count(), 1);
|
|
notification.setIconName(QStringLiteral("bar"));
|
|
QCOMPARE(notification.iconName(), QStringLiteral("bar"));
|
|
QCOMPARE(iconNameChangedSpy.count(), 2);
|
|
}
|
|
|
|
void OnScreenNotificationTest::message()
|
|
{
|
|
OnScreenNotification notification;
|
|
QSignalSpy messageChangedSpy(¬ification, &OnScreenNotification::messageChanged);
|
|
QVERIFY(messageChangedSpy.isValid());
|
|
QCOMPARE(notification.message(), QString());
|
|
notification.setMessage(QStringLiteral("foo"));
|
|
QCOMPARE(notification.message(), QStringLiteral("foo"));
|
|
QCOMPARE(messageChangedSpy.count(), 1);
|
|
notification.setMessage(QStringLiteral("foo"));
|
|
QCOMPARE(messageChangedSpy.count(), 1);
|
|
notification.setMessage(QStringLiteral("bar"));
|
|
QCOMPARE(notification.message(), QStringLiteral("bar"));
|
|
QCOMPARE(messageChangedSpy.count(), 2);
|
|
}
|
|
|
|
#include "onscreennotificationtest.moc"
|