Qt_Core_AD_5_2 - 8BitsCoding/RobotMentor GitHub Wiki


κ²°λ‘ λΆ€ν„° λ§ν•˜λ©΄ 호좜의 μˆœμ„œλŠ”

  1. void initTestCase();

  2. 각 ν•¨μˆ˜λ§ˆλ‹€ μ‹œμž‘ - void init();

  3. 각 ν•¨μˆ˜λ§ˆλ‹€ μ’…λ£Œ - void cleanup();

  4. 각 ν•¨μˆ˜ μ‹€ν–‰

  5. 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";
}

이미지

⚠️ **GitHub.com Fallback** ⚠️