Qt_Core_AD_5_2 - 8BitsCoding/RobotMentor GitHub Wiki
κ²°λ‘ λΆν° λ§νλ©΄ νΈμΆμ μμλ
void initTestCase();
κ° ν¨μλ§λ€ μμ -
void init();
κ° ν¨μλ§λ€ μ’ λ£ -
void cleanup();
κ° ν¨μ μ€ν
void cleanupTestCase();
μ μμΌλ‘ μ€νλλ€. μμΈν건 μλμ κ·Έλ¦ΌνμΌμ 보면 λλ€.
#include <QtCore/QCoreApplication>
#include <qdebug.h>
#include <qtest.h>
#include "Dog.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Dog g;
QTest::qExec(&g);
return a.exec();
}
#pragma once
#include <QObject>
#include <qdebug.h>
class Dog : public QObject
{
Q_OBJECT
public:
explicit Dog(QObject *parent = nullptr);
~Dog();
signals:
public slots:
private slots:
// Called before the first test
void initTestCase();
// Called before each test
void init();
// Called after each test
void cleanup();
// Called after the last test
void cleanupTestCase();
// Our custom slots to be tested
void bark();
// Another custom slot to test
void rollover();
};
#include "Dog.h"
Dog::Dog(QObject *parent)
: QObject(parent)
{
qInfo() << "Constructor";
}
Dog::~Dog()
{
}
void Dog::initTestCase()
{
qInfo() << "initTestCase";
}
void Dog::init()
{
qInfo() << "init";
}
void Dog::cleanup()
{
qInfo() << "cleanup";
}
void Dog::cleanupTestCase()
{
qInfo() << "cleanupTestCase";
}
void Dog::bark()
{
qInfo() << "bark";
}
void Dog::rollover()
{
qInfo() << "rollover";
}