Add TristateCheckBox tests

This commit is contained in:
Clemens Manert 2022-04-26 21:54:02 +02:00
parent bba5ec1fa8
commit ff9e685cc4
No known key found for this signature in database
GPG Key ID: 9197EAE8F85E3A18
4 changed files with 91 additions and 0 deletions

View File

@ -1,2 +1,4 @@
TEMPLATE = subdirs TEMPLATE = subdirs
SUBDIRS += \
tristatecheckbox

View File

@ -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"

View File

@ -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)

View File

@ -0,0 +1,12 @@
CONFIG += qskexample
CONFIG += console
CONFIG += testcase
QT += testlib
HEADERS += \
TristateCheckBox.h
SOURCES += \
TristateCheckBox.cpp