Skip to content
This repository has been archived by the owner on Aug 31, 2020. It is now read-only.

Commit

Permalink
Added templates for next test classes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliagoda committed Nov 5, 2019
1 parent 4fd9457 commit 1bcf412
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/addeditautoprofiledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ AddEditAutoProfileDialog::AddEditAutoProfileDialog(AutoProfileInfo *info, AntiMi
}


// created for tests
AddEditAutoProfileDialog::AddEditAutoProfileDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AddEditAutoProfileDialog)
{

}


AddEditAutoProfileDialog::~AddEditAutoProfileDialog()
{
qInstallMessageHandler(MessageHandler::myMessageOutput);
Expand Down
3 changes: 3 additions & 0 deletions src/addeditautoprofiledialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class AddEditAutoProfileDialog : public QDialog
explicit AddEditAutoProfileDialog(AutoProfileInfo *info, AntiMicroSettings *settings, QList<InputDevice*> *devices,
QList<QString> &reservedUniques,
bool edit=false, QWidget *parent = nullptr);

AddEditAutoProfileDialog(QWidget *parent = nullptr);

~AddEditAutoProfileDialog();

AutoProfileInfo* getAutoProfile() const;
Expand Down
10 changes: 10 additions & 0 deletions src/advancebuttondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ AdvanceButtonDialog::AdvanceButtonDialog(JoyButton *button, QWidget *parent) :
}


// for tests
AdvanceButtonDialog::AdvanceButtonDialog(QWidget *parent) :
QDialog(parent, Qt::Window),
ui(new Ui::AdvanceButtonDialog),
helper(nullptr)
{

}


AdvanceButtonDialog::~AdvanceButtonDialog()
{
qInstallMessageHandler(MessageHandler::myMessageOutput);
Expand Down
1 change: 1 addition & 0 deletions src/advancebuttondialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class AdvanceButtonDialog : public QDialog

public:
explicit AdvanceButtonDialog(JoyButton *button, QWidget *parent=0);
AdvanceButtonDialog(QWidget *parent=0);
~AdvanceButtonDialog();

int getOldRow() const;
Expand Down
8 changes: 8 additions & 0 deletions src/advancestickassignmentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ AdvanceStickAssignmentDialog::AdvanceStickAssignmentDialog(Joystick *joystick, Q
connect(this, &AdvanceStickAssignmentDialog::finished, this, &AdvanceStickAssignmentDialog::reenableButtonEvents);
}

// for tests
AdvanceStickAssignmentDialog::AdvanceStickAssignmentDialog(QWidget *parent) :
QDialog(parent, Qt::Window),
ui(new Ui::AdvanceStickAssignmentDialog)
{

}


AdvanceStickAssignmentDialog::~AdvanceStickAssignmentDialog()
{
Expand Down
1 change: 1 addition & 0 deletions src/advancestickassignmentdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class AdvanceStickAssignmentDialog : public QDialog

public:
explicit AdvanceStickAssignmentDialog(Joystick *joystick, QWidget *parent = nullptr);
AdvanceStickAssignmentDialog(QWidget *parent = nullptr);
~AdvanceStickAssignmentDialog();

Joystick *getJoystick() const;
Expand Down
8 changes: 8 additions & 0 deletions src/axiseditdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ AxisEditDialog::AxisEditDialog(JoyAxis *axis, QWidget *parent) :
connect(this, &AxisEditDialog::finished, this, &AxisEditDialog::checkFinalSettings);
}

// for tests
AxisEditDialog::AxisEditDialog(QWidget *parent) :
QDialog(parent, Qt::Window),
ui(new Ui::AxisEditDialog)
{

}

AxisEditDialog::~AxisEditDialog()
{
qInstallMessageHandler(MessageHandler::myMessageOutput);
Expand Down
1 change: 1 addition & 0 deletions src/axiseditdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class AxisEditDialog : public QDialog

public:
explicit AxisEditDialog(JoyAxis *axis, QWidget *parent=0);
AxisEditDialog(QWidget *parent=0);
~AxisEditDialog();

protected:
Expand Down
9 changes: 9 additions & 0 deletions src/buttoneditdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ ButtonEditDialog::ButtonEditDialog(JoyButton* button, InputDevice* joystick, QWi
refreshForLastBtn();
}

// for tests
ButtonEditDialog::ButtonEditDialog(QWidget *parent) :
QDialog(parent, Qt::Window),
helper(),
ui(new Ui::ButtonEditDialog)
{

}


ButtonEditDialog* ButtonEditDialog::getInstance()
{
Expand Down
1 change: 1 addition & 0 deletions src/buttoneditdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class ButtonEditDialog : public QDialog
public:
explicit ButtonEditDialog(JoyButton* button, InputDevice* joystick, QWidget *parent = nullptr); // called for chosen button
explicit ButtonEditDialog(InputDevice* joystick, QWidget *parent = nullptr); // Accessed by pressing the "Quick Set" button
ButtonEditDialog(QWidget *parent = 0);
~ButtonEditDialog();

static ButtonEditDialog* getInstance();
Expand Down
14 changes: 10 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(Qt5Test REQUIRED)

add_executable(aboutdialogClass testaboutdialog.cpp)
target_link_libraries(aboutdialogClass antilib Qt5::Test)

add_test (NAME testAboutDialog COMMAND aboutdialogClass)
set( GUIS_SRCS testaboutdialog.cpp
testaddeditautoprofiledialog.cpp
testadvancebuttondialog.cpp
testadvancestickassignmentdialog.cpp
testaxiseditdialog.cpp
testbuttoneditdialog.cpp
)
add_executable( GuiTests ${GUIS_SRCS} )
target_link_libraries( GuiTests antilib Qt5::Test )
ADD_TEST( NAME GuiTests COMMAND GuiTests )
27 changes: 27 additions & 0 deletions tests/testaddeditautoprofiledialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "addeditautoprofiledialog.h"

#include <QtTest/QtTest>


class TestAddEditAutoProfileDialog: public QObject
{
Q_OBJECT

public:
TestAddEditAutoProfileDialog(QObject* parent = 0);

private slots:

private:
AddEditAutoProfileDialog addEditAutoProfileDialog;
};

TestAddEditAutoProfileDialog::TestAddEditAutoProfileDialog(QObject* parent) :
QObject(parent),
addEditAutoProfileDialog()
{
QTestEventLoop::instance().enterLoop(1);
}

// QTEST_MAIN(TestAddEditAutoProfileDialog)
#include "testaddeditautoprofiledialog.moc"
27 changes: 27 additions & 0 deletions tests/testadvancebuttondialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "advancebuttondialog.h"

#include <QtTest/QtTest>


class TestAdvanceButtonDialog: public QObject
{
Q_OBJECT

public:
TestAdvanceButtonDialog(QObject* parent = 0);

private slots:

private:
AdvanceButtonDialog advanceButtonDialog;
};

TestAdvanceButtonDialog::TestAdvanceButtonDialog(QObject* parent) :
QObject(parent),
advanceButtonDialog()
{
QTestEventLoop::instance().enterLoop(1);
}

// QTEST_MAIN(TestAdvanceButtonDialog)
#include "testadvancebuttondialog.moc"
28 changes: 28 additions & 0 deletions tests/testadvancestickassignmentdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "advancestickassignmentdialog.h"

#include <QtTest/QtTest>


class TestAdvanceStickAssignmentDialog: public QObject
{
Q_OBJECT

public:
TestAdvanceStickAssignmentDialog(QObject* parent = 0);

private slots:

private:
AdvanceStickAssignmentDialog advanceStickAssignmentDialog;
};

TestAdvanceStickAssignmentDialog::TestAdvanceStickAssignmentDialog(QObject* parent) :
QObject(parent),
advanceStickAssignmentDialog()
{
QTestEventLoop::instance().enterLoop(1);
}

// QTEST_MAIN(TestAdvanceButtonDialog)
#include "testadvancestickassignmentdialog.moc"

29 changes: 29 additions & 0 deletions tests/testaxiseditdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "axiseditdialog.h"

#include <QtTest/QtTest>


class TestAxisEditDialog: public QObject
{
Q_OBJECT

public:
TestAxisEditDialog(QObject* parent = 0);

private slots:

private:
AxisEditDialog axisEditDialog;
};

TestAxisEditDialog::TestAxisEditDialog(QObject* parent) :
QObject(parent),
axisEditDialog()
{
QTestEventLoop::instance().enterLoop(1);
}

// QTEST_MAIN(TestAxisEditDialog)
#include "testaxiseditdialog.moc"


27 changes: 27 additions & 0 deletions tests/testbuttoneditdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "buttoneditdialog.h"

#include <QtTest/QtTest>


class TestButtonEditDialog: public QObject
{
Q_OBJECT

public:
TestButtonEditDialog(QObject* parent = 0);

private slots:

private:
ButtonEditDialog buttonEditDialog;
};

TestButtonEditDialog::TestButtonEditDialog(QObject* parent) :
QObject(parent),
buttonEditDialog()
{
QTestEventLoop::instance().enterLoop(1);
}

// QTEST_MAIN(TestButtonEditDialog)
#include "testbuttoneditdialog.cpp"

0 comments on commit 1bcf412

Please sign in to comment.