Add TristateCheckBox tests
This commit is contained in:
parent
bba5ec1fa8
commit
ff9e685cc4
|
@ -1,2 +1,4 @@
|
|||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += \
|
||||
tristatecheckbox
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#include "TristateCheckBox.h"
|
||||
|
||||
#include <QskTristateCheckBox.h>
|
||||
|
||||
void TristateCheckBox::init()
|
||||
{
|
||||
root = new QskControl();
|
||||
}
|
||||
|
||||
void TristateCheckBox::cleanup()
|
||||
{
|
||||
delete root;
|
||||
}
|
||||
|
||||
void TristateCheckBox::checkbox()
|
||||
{
|
||||
auto t = new QskTristateCheckBox( root );
|
||||
|
||||
QVERIFY( t->isCheckable() );
|
||||
}
|
||||
|
||||
void TristateCheckBox::click()
|
||||
{
|
||||
auto t = new QskTristateCheckBox( root );
|
||||
|
||||
QVERIFY( t->isChecked() == false );
|
||||
t->click();
|
||||
QVERIFY( t->isChecked() );
|
||||
}
|
||||
|
||||
void TristateCheckBox::toggle()
|
||||
{
|
||||
auto t = new QskTristateCheckBox( root );
|
||||
|
||||
QVERIFY( t->isChecked() == false );
|
||||
t->toggle();
|
||||
QVERIFY( t->isChecked() );
|
||||
|
||||
t->toggle();
|
||||
QVERIFY( t->isChecked() == false );
|
||||
}
|
||||
|
||||
void TristateCheckBox::tristate()
|
||||
{
|
||||
auto t = new QskTristateCheckBox( root );
|
||||
|
||||
QVERIFY( t->isChecked() == false );
|
||||
|
||||
t->setCheckState( Qt::CheckState::PartiallyChecked );
|
||||
|
||||
QVERIFY( t->isChecked() == true );
|
||||
}
|
||||
|
||||
#include "moc_TristateCheckBox.cpp"
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include <qobject.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class QskControl;
|
||||
class TristateCheckBox : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QskControl * root;
|
||||
private Q_SLOTS:
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void checkbox();
|
||||
void click();
|
||||
void toggle();
|
||||
void tristate();
|
||||
};
|
||||
|
||||
QTEST_MAIN(TristateCheckBox)
|
|
@ -0,0 +1,12 @@
|
|||
CONFIG += qskexample
|
||||
CONFIG += console
|
||||
CONFIG += testcase
|
||||
|
||||
QT += testlib
|
||||
|
||||
HEADERS += \
|
||||
TristateCheckBox.h
|
||||
|
||||
SOURCES += \
|
||||
TristateCheckBox.cpp
|
||||
|
Loading…
Reference in New Issue