main.cpp
86 lines
| 2.7 KiB
| text/x-c
|
CppLexer
r1408 | #include <QMainWindow> | |||
#include <QObject> | ||||
#include <QScreen> | ||||
#include <QString> | ||||
#include <QWheelEvent> | ||||
#include <QtTest> | ||||
r1477 | #include <cstdlib> | |||
r1408 | ||||
r1486 | #include <cpp_utils.hpp> | |||
r1408 | #include <SqpApplication.h> | |||
#include <GUITestUtils.h> | ||||
#include <Catalogue/CatalogueController.h> | ||||
#include <Catalogue2/browser.h> | ||||
r1477 | template <int EventsCount = 1000> | |||
auto build_CatalogueBrowser_test() | ||||
{ | ||||
sqpApp->catalogueController().add("test"); | ||||
sqpApp->catalogueController().add("stuff"); | ||||
sqpApp->catalogueController().add("default"); | ||||
sqpApp->catalogueController().add("new catalogue", "default"); | ||||
auto catalogue = sqpApp->catalogueController().add("new catalogue2", "default"); | ||||
for (auto _ : std::array<char, EventsCount>()) | ||||
{ | ||||
r1485 | (void)_; | |||
r1477 | static int i = 0; | |||
auto event = CatalogueController::make_event_ptr(); | ||||
event->name = std::string("Event ") + std::to_string(i++); | ||||
event->tags = { "tag1", "tag2" }; | ||||
event->products = { CatalogueController::Event_t::Product_t { | ||||
std::string("Product2") + std::to_string(rand() % 30), | ||||
static_cast<double>(1532357932 + rand() % 100), | ||||
static_cast<double>(1532358932 + rand() % 100) }, | ||||
CatalogueController::Event_t::Product_t { | ||||
std::string("Product2") + std::to_string(rand() % 30), | ||||
static_cast<double>(1532357932 + rand() % 200), | ||||
static_cast<double>(1532358932 + rand() % 200) }, | ||||
CatalogueController::Event_t::Product_t { | ||||
std::string("Product2") + std::to_string(rand() % 30), | ||||
static_cast<double>(1532357932 + rand() % 70), | ||||
static_cast<double>(1532358932 + rand() % 70) } }; | ||||
catalogue->add(event); | ||||
} | ||||
return std::make_unique<CataloguesBrowser>(); | ||||
} | ||||
r1408 | ||||
class A_CatalogueBrowser : public QObject | ||||
{ | ||||
Q_OBJECT | ||||
public: | ||||
explicit A_CatalogueBrowser(QObject* parent = Q_NULLPTR) : QObject(parent) {} | ||||
private slots: | ||||
r1477 | void can_sort_events() | |||
{ | ||||
auto w = build_CatalogueBrowser_test(); | ||||
QVERIFY(prepare_gui_test(w.get())); | ||||
// GET_CHILD_WIDGET_FOR_GUI_TESTS((*w.get()),,,) | ||||
for (int i = 0; i < 1000000; i++) | ||||
{ | ||||
QThread::usleep(100); | ||||
QCoreApplication::processEvents(); | ||||
} | ||||
} | ||||
r1408 | }; | |||
r1477 | QT_BEGIN_NAMESPACE | |||
QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS | ||||
QT_END_NAMESPACE | ||||
r1408 | int main(int argc, char* argv[]) | |||
{ | ||||
Q_INIT_RESOURCE(sqpguiresources); | ||||
r1477 | SqpApplication app { argc, argv }; | |||
app.setAttribute(Qt::AA_Use96Dpi, true); | ||||
QTEST_DISABLE_KEYPAD_NAVIGATION; | ||||
QTEST_ADD_GPU_BLACKLIST_SUPPORT; | ||||
A_CatalogueBrowser tc; | ||||
QTEST_SET_MAIN_SOURCE_PATH; | ||||
return QTest::qExec(&tc, argc, argv); | ||||
r1408 | } | |||
r1477 | ||||
#include "main.moc" | ||||