• 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
contenttypewidgettest.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 "contenttypewidgettest.h"
22 #include "../contenttypewidget.h"
23 #include <kcombobox.h>
24 #include <qlabel.h>
25 #include <qtest_kde.h>
26 ContentTypeWidgetTest::ContentTypeWidgetTest(QObject *parent)
27  : QObject(parent)
28 {
29 
30 }
31 
32 ContentTypeWidgetTest::~ContentTypeWidgetTest()
33 {
34 
35 }
36 
37 void ContentTypeWidgetTest::shouldHaveDefaultValue()
38 {
39  MailCommon::ContentTypeWidget widget;
40  QLabel *label = qFindChild<QLabel *>(&widget, QLatin1String("contenttypewidgetlabel"));
41  QVERIFY(label);
42  KComboBox *combo = qFindChild<KComboBox *>(&widget, QLatin1String("contentcombobox"));
43  QVERIFY(combo);
44  QVERIFY(combo->count()>0);
45  QCOMPARE(widget.currentIndex(), 0);
46 }
47 
48 void ContentTypeWidgetTest::shouldChangeComboBoxIndex()
49 {
50  MailCommon::ContentTypeWidget contentType;
51  KComboBox *combo = qFindChild<KComboBox *>(&contentType, QLatin1String("contentcombobox"));
52  for (int i = 0 ; i < combo->count() ; ++i) {
53  contentType.setCurrentIndex(i);
54  QCOMPARE(contentType.currentIndex(), i);
55  QCOMPARE(combo->currentIndex(), i);
56  }
57 }
58 
59 void ContentTypeWidgetTest::shouldEmitSignalWhenIndexChanged()
60 {
61  MailCommon::ContentTypeWidget contentType;
62  contentType.show();
63  QTest::qWaitForWindowShown(&contentType);
64  QSignalSpy spy(&contentType, SIGNAL(activated(int)));
65  contentType.setCurrentIndex(1);
66  //FIXME
67  //QCOMPARE(spy.at(0).count(), 1);
68 }
69 
70 void ContentTypeWidgetTest::shouldChangeItem()
71 {
72  MailCommon::ContentTypeWidget contentType;
73  contentType.show();
74  QTest::qWaitForWindowShown(&contentType);
75  KComboBox *combo = qFindChild<KComboBox *>(&contentType, QLatin1String("contentcombobox"));
76  for (int i = 0 ; i < combo->count() ; ++i) {
77  contentType.setCurrentIndex(i);
78  QCOMPARE(contentType.currentText(), combo->currentText());
79  }
80 
81 }
82 
83 QTEST_KDEMAIN(ContentTypeWidgetTest, GUI)
QTest::qWaitForWindowShown
bool qWaitForWindowShown(QWidget *window)
ContentTypeWidgetTest::ContentTypeWidgetTest
ContentTypeWidgetTest(QObject *parent=0)
Definition: contenttypewidgettest.cpp:26
contenttypewidgettest.h
MailCommon::ContentTypeWidget
Definition: contenttypewidget.h:28
ContentTypeWidgetTest::~ContentTypeWidgetTest
~ContentTypeWidgetTest()
Definition: contenttypewidgettest.cpp:32
QObject
QSignalSpy
ContentTypeWidgetTest
Definition: contenttypewidgettest.h:26
QLatin1String
QWidget::show
void show()
QLabel
MailCommon::ContentTypeWidget::setCurrentIndex
void setCurrentIndex(int index)
Definition: contenttypewidget.cpp:67
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