• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

mailcommon

  • sources
  • kde-4.14
  • kdepim
  • mailcommon
  • collectionpage
  • autotests
incidencesforwidgettest.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014-2015 Montel Laurent <montel@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 
19 */
20 
21 #include "incidencesforwidgettest.h"
22 #include "../incidencesforwidget.h"
23 #include <kcombobox.h>
24 #include <qlabel.h>
25 #include <qtest_kde.h>
26 #include <QSignalSpy>
27 
28 IncidencesForWidgetTest::IncidencesForWidgetTest(QObject *parent)
29  : QObject(parent)
30 {
31 
32 }
33 
34 IncidencesForWidgetTest::~IncidencesForWidgetTest()
35 {
36 
37 }
38 
39 void IncidencesForWidgetTest::shouldHaveDefaultValue()
40 {
41  MailCommon::IncidencesForWidget contentType;
42  QLabel *label = qFindChild<QLabel *>(&contentType, QLatin1String("contentstypelabel"));
43  QVERIFY(label);
44  KComboBox *combo = qFindChild<KComboBox *>(&contentType, QLatin1String("contentstypecombobox"));
45  QVERIFY(combo);
46  QVERIFY(combo->count()>0);
47  QCOMPARE(contentType.currentIndex(), 0);
48 }
49 
50 void IncidencesForWidgetTest::shouldChangeComboBoxIndex()
51 {
52  MailCommon::IncidencesForWidget contentType;
53  KComboBox *combo = qFindChild<KComboBox *>(&contentType, QLatin1String("contentstypecombobox"));
54  for (int i = 0 ; i < combo->count() ; ++i) {
55  contentType.setCurrentIndex(i);
56  QCOMPARE(contentType.currentIndex(), i);
57  QCOMPARE(combo->currentIndex(), i);
58  }
59 }
60 
61 void IncidencesForWidgetTest::shouldEmitSignalWhenIndexChanged()
62 {
63  MailCommon::IncidencesForWidget contentType;
64  contentType.show();
65  QTest::qWaitForWindowShown(&contentType);
66  QSignalSpy spy(&contentType, SIGNAL(currentIndexChanged(int)));
67  contentType.setCurrentIndex(1);
68  QCOMPARE(spy.at(0).count(), 1);
69 }
70 
71 QTEST_KDEMAIN(IncidencesForWidgetTest, GUI)
IncidencesForWidgetTest::~IncidencesForWidgetTest
~IncidencesForWidgetTest()
Definition: incidencesforwidgettest.cpp:34
QTest::qWaitForWindowShown
bool qWaitForWindowShown(QWidget *window)
IncidencesForWidgetTest
Definition: incidencesforwidgettest.h:25
incidencesforwidgettest.h
MailCommon::IncidencesForWidget
Definition: incidencesforwidget.h:29
QObject
MailCommon::IncidencesForWidget::setCurrentIndex
void setCurrentIndex(int index)
Definition: incidencesforwidget.cpp:76
QSignalSpy
IncidencesForWidgetTest::IncidencesForWidgetTest
IncidencesForWidgetTest(QObject *parent=0)
Definition: incidencesforwidgettest.cpp:28
QLatin1String
QWidget::show
void show()
QLabel
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailcommon

Skip menu "mailcommon"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal