nxdk_pgraph_tests
A collection of tests for the Xbox nv2a graphics processor
 
Loading...
Searching...
No Matches
test_driver.h
1#ifndef NXDK_PGRAPH_TESTS_TEST_DRIVER_H
2#define NXDK_PGRAPH_TESTS_TEST_DRIVER_H
3
4#include <SDL.h>
5
6#include <cstdint>
7#include <list>
8#include <map>
9#include <memory>
10#include <set>
11#include <string>
12#include <vector>
13
14#include "test_host.h"
15#include "tests/test_suite.h"
16
17constexpr uint32_t kMaxGamepads = 4;
18
19struct MenuItem;
20
25 public:
26 TestDriver(TestHost &host, const std::vector<std::shared_ptr<TestSuite>> &test_suites, uint32_t framebuffer_width,
27 uint32_t framebuffer_height, bool show_options_menu, bool disable_autorun, bool autorun_immediately);
29
31 void Run();
32
35
36 private:
37 void OnControllerAdded(const SDL_ControllerDeviceEvent &event);
38 void OnControllerRemoved(const SDL_ControllerDeviceEvent &event);
39 void OnControllerButtonEvent(const SDL_ControllerButtonEvent &event);
40 void OnButtonActivated(SDL_GameControllerButton button, bool is_repeat);
41
42 void ShowDebugMessageAndExit();
43
44 void OnBack(bool is_repeat);
45 void OnStart(bool is_repeat);
46 void OnBlack(bool is_repeat);
47 void OnWhite(bool is_repeat);
48 void OnUp(bool is_repeat);
49 void OnDown(bool is_repeat);
50 void OnLeft(bool is_repeat);
51 void OnRight(bool is_repeat);
52 void OnA(bool is_repeat);
53 void OnB(bool is_repeat);
54 void OnX(bool is_repeat);
55 void OnY(bool is_repeat);
56
57 private:
58 volatile bool running_{true};
59
60 const std::vector<std::shared_ptr<TestSuite>> &test_suites_;
61 SDL_GameController *gamepads_[kMaxGamepads]{nullptr};
62
63 TestHost &test_host_;
64 std::shared_ptr<MenuItem> active_menu_;
65 std::shared_ptr<MenuItem> root_menu_;
66 std::shared_ptr<MenuItem> options_menu_;
67};
68
69#endif // NXDK_PGRAPH_TESTS_TEST_DRIVER_H
Definition test_driver.h:24
void RunAllTestsNonInteractive()
Runs all tests automatically without reacting to any user input.
Definition test_driver.cpp:98
void Run()
Enters a loop that reacts to user input until the user requests an exit.
Definition test_driver.cpp:46
Definition test_host.h:47
Definition menu_item.h:13