1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
/*
File : CommonTest.cpp
Project : LabPlot
Description : General test class
--------------------------------------------------------------------
SPDX-FileCopyrightText: 2019-2024 Stefan Gerlach <stefan.gerlach@uni.kn>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "CommonTest.h"
#include "src/backend/core/AbstractColumn.h"
#include <QUndoStack>
#ifdef _WIN32
#include <windows.h>
#endif
void CommonTest::initTestCase() {
// always enable debugging
enableDebugTrace(true);
KLocalizedString::setApplicationDomain("labplot");
#ifdef _WIN32
// if (AttachConsole(ATTACH_PARENT_PROCESS)) {
// freopen("CONOUT$", "w", stdout);
// freopen("CONOUT$", "w", stderr);
// }
#endif
}
void CommonTest::listStack(QUndoStack* stack) {
qDebug() << "--------------------------";
qDebug() << "Begin list Undostack History";
if (stack) {
for (int i = 0; i < stack->count(); i++) {
qDebug() << stack->text(i);
}
}
qDebug() << "End list Undostack History";
qDebug() << "--------------------------";
}
void CommonTest::wait(int milliseconds) {
QTimer timer(this);
QEventLoop loop;
QTimer::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
timer.start(milliseconds);
loop.exec();
}
|