NDEVR
API Documentation
AutomatedTesting.h
1#pragma once
2#include <NDEVR/RibbonSubGroup.h>
3#include <NDEVR/QTWindowManager.h>
4#include <NDEVR/File.h>
5#include <QWidget>
6namespace NDEVR
7{
9 class WindowManager;
10
16 {
17 public:
29 virtual void stopTest() = 0;
30 std::function<void()> on_test_completed;
31 bool is_looped_test = false;
32 };
33
37 class NDEVR_API LoopedAutomatedTest : public AutomatedTest
38 {
39 public:
44 LoopedAutomatedTest(const std::function<void(uint04 step_index, AutomatedTestingDialog* dialog)>& test_step);
54 void stopTest();
59 uint04 testStepIndex() const { return m_step_index; }
60 protected:
61 std::function<void(uint04 step_index, AutomatedTestingDialog* dialog)> m_on_test;
62 QTimer* m_test_timer;
65 };
66
70 class NDEVR_API NewProjectTest : public LoopedAutomatedTest
71 {
72 public:
78 };
79
83 class NDEVR_API OpenCloseTest : public LoopedAutomatedTest
84 {
85 public:
91 };
92
96 class NDEVR_API GrabNetworkInfo : public AutomatedTest
97 {
98 public:
113 void stopTest();
114 };
115 class Connection;
120 class NDEVR_API AutomatedTestingDialog : public RibbonSubGroup
121 {
122 public:
127 AutomatedTestingDialog(QWidget* parent = nullptr);
141 static void AddTest(AutomatedTest* test);
147 protected:
150 protected:
152 };
153}
base class for performing a test for easily testing certain software functionality
TranslatedString name
The user-facing translated name of the test.
std::function< void()> on_test_completed
Callback invoked when the test finishes.
String icon
The icon resource name displayed for this test.
virtual void stopTest()=0
Stops the currently running test.
virtual bool performTest(AutomatedTestingDialog *)=0
Executes the test.
bool is_looped_test
Whether this test repeats in a loop until stopped.
Gives user information and allows execution for all registered automated testing.
Buffer< AutomatedTest * > m_automated_tests
The list of tests registered with this dialog instance.
File m_test_folder
The folder used for test output and data.
void chooseTestFolder()
Opens a folder chooser dialog for selecting the test output directory.
File testFolder() const
Returns the folder path used for test output and data.
static void AddTest(AutomatedTest *test)
Registers an automated test globally so it appears in all testing dialogs.
AutomatedTestingDialog(QWidget *parent=nullptr)
Constructs the AutomatedTestingDialog.
static Buffer< AutomatedTest * > s_application_tests
The global list of registered automated tests.
void addTest(AutomatedTest *test)
Adds an automated test to this dialog instance.
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A standard interface for all types of connections that allow transmitting and receiving of data betwe...
Definition Connection.h:316
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
GrabNetworkInfo(WindowManager *manager)
Constructs a test that gathers network diagnostic information.
bool performTest(AutomatedTestingDialog *dialog)
Executes the network information gathering test.
void stopTest()
Stops the network information test.
QTimer * m_test_timer
The timer driving the loop iterations.
std::function< void(uint04 step_index, AutomatedTestingDialog *dialog)> m_on_test
The function executed on each loop step.
void stopTest()
Stops the looped test timer.
LoopedAutomatedTest(const std::function< void(uint04 step_index, AutomatedTestingDialog *dialog)> &test_step)
Constructs a LoopedAutomatedTest with the given step function.
uint04 m_step_index
The current loop iteration index.
AutomatedTestingDialog * m_dialog
The testing dialog reference.
bool performTest(AutomatedTestingDialog *dialog)
Starts the looped test, calling the step function repeatedly on a timer.
uint04 testStepIndex() const
Returns the current step index within the loop.
NewProjectTest(WindowManager *manager)
Constructs a test that repeatedly creates and destroys projects.
OpenCloseTest(WindowManager *manager)
Constructs a test that repeatedly opens and closes a project.
RibbonSubGroup(QWidget *parent=nullptr)
Constructs a ribbon sub-group widget.
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Manages all windows and logic surrounding dialogs and views for displaying and managing any environme...
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...