File indexing completed on 2022-11-29 18:25:14

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
0003 
0004     Permission to use, copy, modify, and distribute this software
0005     and its documentation for any purpose and without fee is hereby
0006     granted, provided that the above copyright notice appear in all
0007     copies and that both that the copyright notice and this
0008     permission notice and warranty disclaimer appear in supporting
0009     documentation, and that the name of the author not be used in
0010     advertising or publicity pertaining to distribution of the
0011     software without specific, written prior permission.
0012 
0013     The author disclaim all warranties with regard to this
0014     software, including all implied warranties of merchantability
0015     and fitness.  In no event shall the author be liable for any
0016     special, indirect or consequential damages or any damages
0017     whatsoever resulting from loss of use, data or profits, whether
0018     in an action of contract, negligence or other tortious action,
0019     arising out of or in connection with the use or performance of
0020     this software.
0021 
0022 */
0023 
0024 #include <qtest_kde.h>
0025 #include <kfadewidgeteffect.h>
0026 #include <QPointer>
0027 
0028 class KFadeWidgetEffectTest : public QObject
0029 {
0030     Q_OBJECT
0031 private Q_SLOTS:
0032     void initTestCase();
0033     void createEffect();
0034     void startEffect();
0035     void cleanupTestCase();
0036 
0037 private:
0038     QWidget *parent, *w;
0039     QPointer<KFadeWidgetEffect> fade;
0040 };
0041 
0042 void KFadeWidgetEffectTest::initTestCase()
0043 {
0044     parent = new QWidget;
0045     w = new QWidget(parent);
0046     //parent->show();
0047 }
0048 
0049 void KFadeWidgetEffectTest::createEffect()
0050 {
0051     fade = new KFadeWidgetEffect(w);
0052 }
0053 
0054 void KFadeWidgetEffectTest::startEffect()
0055 {
0056     fade->start(250);
0057     QVERIFY(QTest::kWaitForSignal(fade, SIGNAL(destroyed(QObject*)), 2000));
0058 }
0059 
0060 void KFadeWidgetEffectTest::cleanupTestCase()
0061 {
0062     QVERIFY(!fade);
0063     delete parent;
0064 }
0065 
0066 QTEST_KDEMAIN(KFadeWidgetEffectTest, GUI)
0067 
0068 #include "kfadewidgeteffecttest.moc"