SonarQube warnings.
--HG-- branch : develop
This commit is contained in:
parent
cd37c4a48c
commit
d0cc8902f9
|
@ -204,11 +204,11 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
messageBox.setWindowModality(Qt::ApplicationModal);
|
messageBox.setWindowModality(Qt::ApplicationModal);
|
||||||
messageBox.setModal(true);
|
messageBox.setModal(true);
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::setOverrideCursor(Qt::ArrowCursor);
|
QGuiApplication::setOverrideCursor(Qt::ArrowCursor);
|
||||||
#endif
|
#endif
|
||||||
messageBox.exec();
|
messageBox.exec();
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -482,16 +482,16 @@ QString MApplication::diagramsPath() const
|
||||||
{
|
{
|
||||||
const QString dPath = QStringLiteral("/diagrams.rcc");
|
const QString dPath = QStringLiteral("/diagrams.rcc");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return QApplication::applicationDirPath() + dPath;
|
return QCoreApplication::applicationDirPath() + dPath;
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
QFileInfo fileBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + dPath);
|
QFileInfo fileBundle(QCoreApplication::applicationDirPath() + QStringLiteral("/../Resources") + dPath);
|
||||||
if (fileBundle.exists())
|
if (fileBundle.exists())
|
||||||
{
|
{
|
||||||
return fileBundle.absoluteFilePath();
|
return fileBundle.absoluteFilePath();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QFileInfo file(QApplication::applicationDirPath() + dPath);
|
QFileInfo file(QCoreApplication::applicationDirPath() + dPath);
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
return file.absoluteFilePath();
|
return file.absoluteFilePath();
|
||||||
|
@ -502,7 +502,7 @@ QString MApplication::diagramsPath() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // Unix
|
#else // Unix
|
||||||
QFileInfo file(QApplication::applicationDirPath() + dPath);
|
QFileInfo file(QCoreApplication::applicationDirPath() + dPath);
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
return file.absoluteFilePath();
|
return file.absoluteFilePath();
|
||||||
|
|
|
@ -2607,7 +2607,7 @@ void TMainWindow::UpdateWindowTitle()
|
||||||
setWindowFilePath(curFile);
|
setWindowFilePath(curFile);
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
static QIcon fileIcon = QIcon(QApplication::applicationDirPath() +
|
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() +
|
||||||
QLatin1String("/../Resources/measurements.icns"));
|
QLatin1String("/../Resources/measurements.icns"));
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
if (not curFile.isEmpty())
|
if (not curFile.isEmpty())
|
||||||
|
|
|
@ -218,11 +218,11 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
messageBox.setWindowModality(Qt::ApplicationModal);
|
messageBox.setWindowModality(Qt::ApplicationModal);
|
||||||
messageBox.setModal(true);
|
messageBox.setModal(true);
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::setOverrideCursor(Qt::ArrowCursor);
|
QGuiApplication::setOverrideCursor(Qt::ArrowCursor);
|
||||||
#endif
|
#endif
|
||||||
messageBox.exec();
|
messageBox.exec();
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,24 +403,24 @@ QString VApplication::TapeFilePath() const
|
||||||
{
|
{
|
||||||
const QString tape = QStringLiteral("tape");
|
const QString tape = QStringLiteral("tape");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape + ".exe");
|
QFileInfo tapeFile(QCoreApplication::applicationDirPath() + "/" + tape + ".exe");
|
||||||
if (tapeFile.exists())
|
if (tapeFile.exists())
|
||||||
{
|
{
|
||||||
return tapeFile.absoluteFilePath();
|
return tapeFile.absoluteFilePath();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return QApplication::applicationDirPath() + "/../../tape/bin/" + tape + ".exe";
|
return QCoreApplication::applicationDirPath() + "/../../tape/bin/" + tape + ".exe";
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape);
|
QFileInfo tapeFile(QCoreApplication::applicationDirPath() + "/" + tape);
|
||||||
if (tapeFile.exists())
|
if (tapeFile.exists())
|
||||||
{
|
{
|
||||||
return tapeFile.absoluteFilePath();
|
return tapeFile.absoluteFilePath();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QFileInfo file(QApplication::applicationDirPath() + "/../../tape/bin/" + tape);
|
QFileInfo file(QCoreApplication::applicationDirPath() + "/../../tape/bin/" + tape);
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
return file.absoluteFilePath();
|
return file.absoluteFilePath();
|
||||||
|
@ -431,14 +431,14 @@ QString VApplication::TapeFilePath() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // Unix
|
#else // Unix
|
||||||
QFileInfo file(QApplication::applicationDirPath() + "/../../tape/bin/" + tape);
|
QFileInfo file(QCoreApplication::applicationDirPath() + "/../../tape/bin/" + tape);
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
{
|
{
|
||||||
return file.absoluteFilePath();
|
return file.absoluteFilePath();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape);
|
QFileInfo tapeFile(QCoreApplication::applicationDirPath() + "/" + tape);
|
||||||
if (tapeFile.exists())
|
if (tapeFile.exists())
|
||||||
{
|
{
|
||||||
return tapeFile.absoluteFilePath();
|
return tapeFile.absoluteFilePath();
|
||||||
|
|
|
@ -2788,7 +2788,7 @@ void MainWindow::Clear()
|
||||||
qApp->setPatternType(MeasurementsType::Unknown);
|
qApp->setPatternType(MeasurementsType::Unknown);
|
||||||
ui->toolBarOption->clear();
|
ui->toolBarOption->clear();
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
#endif
|
#endif
|
||||||
CleanLayout();
|
CleanLayout();
|
||||||
listDetails.clear(); // don't move to CleanLayout()
|
listDetails.clear(); // don't move to CleanLayout()
|
||||||
|
@ -2993,7 +2993,7 @@ void MainWindow::SetEnabledGUI(bool enabled)
|
||||||
SetEnableTool(enabled);
|
SetEnableTool(enabled);
|
||||||
ui->toolBarOption->setEnabled(enabled);
|
ui->toolBarOption->setEnabled(enabled);
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::setOverrideCursor(Qt::ArrowCursor);
|
QGuiApplication::setOverrideCursor(Qt::ArrowCursor);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4934,7 +4934,7 @@ void MainWindow::UpdateWindowTitle()
|
||||||
setWindowFilePath(curFile);
|
setWindowFilePath(curFile);
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
static QIcon fileIcon = QIcon(QApplication::applicationDirPath() +
|
static QIcon fileIcon = QIcon(QCoreApplication::applicationDirPath() +
|
||||||
QLatin1String("/../Resources/Valentina.icns"));
|
QLatin1String("/../Resources/Valentina.icns"));
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
if (not curFile.isEmpty())
|
if (not curFile.isEmpty())
|
||||||
|
|
|
@ -261,6 +261,7 @@ void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
|
||||||
case LayoutExportFormats::DXF_AC1024_ASTM:
|
case LayoutExportFormats::DXF_AC1024_ASTM:
|
||||||
case LayoutExportFormats::DXF_AC1027_ASTM:
|
case LayoutExportFormats::DXF_AC1027_ASTM:
|
||||||
Q_UNREACHABLE(); // For now not supported
|
Q_UNREACHABLE(); // For now not supported
|
||||||
|
break;
|
||||||
case LayoutExportFormats::SVG:
|
case LayoutExportFormats::SVG:
|
||||||
paper->setVisible(false);
|
paper->setVisible(false);
|
||||||
SvgFile(name, i);
|
SvgFile(name, i);
|
||||||
|
@ -828,7 +829,7 @@ void MainWindowsNoGUI::PsFile(const QString &name, int i) const
|
||||||
void MainWindowsNoGUI::PdfToPs(const QStringList ¶ms) const
|
void MainWindowsNoGUI::PdfToPs(const QStringList ¶ms) const
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
#endif
|
#endif
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
|
@ -843,7 +844,7 @@ void MainWindowsNoGUI::PdfToPs(const QStringList ¶ms) const
|
||||||
proc.waitForFinished(15000);
|
proc.waitForFinished(15000);
|
||||||
}
|
}
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QFile f(params.last());
|
QFile f(params.last());
|
||||||
|
|
|
@ -140,7 +140,7 @@ void SetOverrideCursor(const QString &pixmapPath, int hotX, int hotY)
|
||||||
|
|
||||||
if (oldImage != newImage )
|
if (oldImage != newImage )
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor(QCursor(newPixmap, hotX, hotY));
|
QGuiApplication::setOverrideCursor(QCursor(newPixmap, hotX, hotY));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(pixmapPath)
|
Q_UNUSED(pixmapPath)
|
||||||
|
@ -163,7 +163,7 @@ void SetOverrideCursor(Qt::CursorShape shape)
|
||||||
QPixmap newPixmap = cursor.pixmap();
|
QPixmap newPixmap = cursor.pixmap();
|
||||||
if (oldPixmap.toImage() != newPixmap.toImage())
|
if (oldPixmap.toImage() != newPixmap.toImage())
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor(cursor);
|
QGuiApplication::setOverrideCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -187,7 +187,7 @@ void RestoreOverrideCursor(const QString &pixmapPath)
|
||||||
|
|
||||||
if (oldImage == newImage )
|
if (oldImage == newImage )
|
||||||
{
|
{
|
||||||
QApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(pixmapPath)
|
Q_UNUSED(pixmapPath)
|
||||||
|
@ -208,7 +208,7 @@ void RestoreOverrideCursor(Qt::CursorShape shape)
|
||||||
QPixmap newPixmap = cursor.pixmap();
|
QPixmap newPixmap = cursor.pixmap();
|
||||||
if (oldPixmap.toImage() == newPixmap.toImage())
|
if (oldPixmap.toImage() == newPixmap.toImage())
|
||||||
{
|
{
|
||||||
QApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -129,16 +129,16 @@ QString VAbstractApplication::translationsPath(const QString &locale) const
|
||||||
const QString trPath = QStringLiteral("/translations");
|
const QString trPath = QStringLiteral("/translations");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
Q_UNUSED(locale)
|
Q_UNUSED(locale)
|
||||||
return QApplication::applicationDirPath() + trPath;
|
return QCoreApplication::applicationDirPath() + trPath;
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
QString mainPath;
|
QString mainPath;
|
||||||
if (locale.isEmpty())
|
if (locale.isEmpty())
|
||||||
{
|
{
|
||||||
mainPath = QApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath;
|
mainPath = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainPath = QApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath + QLatin1String("/")
|
mainPath = QCoreApplication::applicationDirPath() + QLatin1String("/../Resources") + trPath + QLatin1String("/")
|
||||||
+ locale + QLatin1String(".lproj");
|
+ locale + QLatin1String(".lproj");
|
||||||
}
|
}
|
||||||
QDir dirBundle(mainPath);
|
QDir dirBundle(mainPath);
|
||||||
|
@ -164,7 +164,7 @@ QString VAbstractApplication::translationsPath(const QString &locale) const
|
||||||
}
|
}
|
||||||
#else // Unix
|
#else // Unix
|
||||||
Q_UNUSED(locale)
|
Q_UNUSED(locale)
|
||||||
QDir dir(QApplication::applicationDirPath() + trPath);
|
QDir dir(QCoreApplication::applicationDirPath() + trPath);
|
||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
{
|
{
|
||||||
return dir.absolutePath();
|
return dir.absolutePath();
|
||||||
|
|
|
@ -186,9 +186,9 @@ VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &orga
|
||||||
QString VCommonSettings::SharePath(const QString &shareItem)
|
QString VCommonSettings::SharePath(const QString &shareItem)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return QApplication::applicationDirPath() + shareItem;
|
return QCoreApplication::applicationDirPath() + shareItem;
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + shareItem);
|
QDir dirBundle(QCoreApplication::applicationDirPath() + QStringLiteral("/../Resources") + shareItem);
|
||||||
if (dirBundle.exists())
|
if (dirBundle.exists())
|
||||||
{
|
{
|
||||||
return dirBundle.absolutePath();
|
return dirBundle.absolutePath();
|
||||||
|
@ -211,9 +211,9 @@ QString VCommonSettings::SharePath(const QString &shareItem)
|
||||||
}
|
}
|
||||||
#else // Unix
|
#else // Unix
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
return QApplication::applicationDirPath() + shareItem;
|
return QCoreApplication::applicationDirPath() + shareItem;
|
||||||
#else
|
#else
|
||||||
QDir dir(QApplication::applicationDirPath() + shareItem);
|
QDir dir(QCoreApplication::applicationDirPath() + shareItem);
|
||||||
if (dir.exists())
|
if (dir.exists())
|
||||||
{
|
{
|
||||||
return dir.absolutePath();
|
return dir.absolutePath();
|
||||||
|
|
|
@ -79,9 +79,9 @@ QString AbstractTest::ValentinaPath() const
|
||||||
{
|
{
|
||||||
const QString path = QStringLiteral("/../../../app/valentina/bin/valentina");
|
const QString path = QStringLiteral("/../../../app/valentina/bin/valentina");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return QApplication::applicationDirPath() + path + QLatin1String(".exe");
|
return QCoreApplication::applicationDirPath() + path + QLatin1String(".exe");
|
||||||
#else
|
#else
|
||||||
return QApplication::applicationDirPath() + path;
|
return QCoreApplication::applicationDirPath() + path;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,16 +90,16 @@ QString AbstractTest::TapePath() const
|
||||||
{
|
{
|
||||||
const QString path = QStringLiteral("/../../../app/tape/bin/tape");
|
const QString path = QStringLiteral("/../../../app/tape/bin/tape");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return QApplication::applicationDirPath() + path + QLatin1String(".exe");
|
return QCoreApplication::applicationDirPath() + path + QLatin1String(".exe");
|
||||||
#else
|
#else
|
||||||
return QApplication::applicationDirPath() + path;
|
return QCoreApplication::applicationDirPath() + path;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString AbstractTest::TranslationsPath() const
|
QString AbstractTest::TranslationsPath() const
|
||||||
{
|
{
|
||||||
return QApplication::applicationDirPath() + QStringLiteral("/../../../app/valentina/bin/translations");
|
return QCoreApplication::applicationDirPath() + QStringLiteral("/../../../app/valentina/bin/translations");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -98,12 +98,12 @@ DialogEditWrongFormula::DialogEditWrongFormula(const VContainer *data, const qui
|
||||||
|
|
||||||
//Disable Qt::WaitCursor
|
//Disable Qt::WaitCursor
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
if (QApplication::overrideCursor() != nullptr)
|
if (QGuiApplication::overrideCursor() != nullptr)
|
||||||
{
|
{
|
||||||
if (QApplication::overrideCursor()->shape() == Qt::WaitCursor)
|
if (QGuiApplication::overrideCursor()->shape() == Qt::WaitCursor)
|
||||||
{
|
{
|
||||||
restoreCursor = true;
|
restoreCursor = true;
|
||||||
QApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,7 +119,7 @@ DialogEditWrongFormula::~DialogEditWrongFormula()
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
if (restoreCursor)
|
if (restoreCursor)
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QGuiApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
delete ui;
|
delete ui;
|
||||||
|
|
|
@ -388,7 +388,7 @@ void VToolBasePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
|
||||||
{
|
{
|
||||||
qCDebug(vTool, "Context menu base point");
|
qCDebug(vTool, "Context menu base point");
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
QApplication::restoreOverrideCursor();
|
QGuiApplication::restoreOverrideCursor();
|
||||||
qCDebug(vTool, "Restored overriden cursor");
|
qCDebug(vTool, "Restored overriden cursor");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@ void TST_TapeCommandLine::initTestCase()
|
||||||
QFAIL("Fail to remove temp directory.");
|
QFAIL("Fail to remove temp directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() + QStringLiteral("tst_tape"),
|
if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() + QStringLiteral("tst_tape"),
|
||||||
QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
|
QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
|
||||||
{
|
{
|
||||||
QFAIL("Fail to prepare files for testing.");
|
QFAIL("Fail to prepare files for testing.");
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ void TST_TapeCommandLine::OpenMeasurements()
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
const int exit = Run(exitCode, TapePath(), QStringList() << "--test"
|
const int exit = Run(exitCode, TapePath(), QStringList() << "--test"
|
||||||
<< QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder + QDir::separator() +
|
<< QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder + QDir::separator() +
|
||||||
file, error);
|
file, error);
|
||||||
|
|
||||||
QVERIFY2(exit == exitCode, qUtf8Printable(error));
|
QVERIFY2(exit == exitCode, qUtf8Printable(error));
|
||||||
|
|
|
@ -51,9 +51,9 @@ void TST_ValentinaCommandLine::initTestCase()
|
||||||
QFAIL("Fail to remove test temp directory.");
|
QFAIL("Fail to remove test temp directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() +
|
if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() +
|
||||||
QLatin1String("tst_valentina"),
|
QLatin1String("tst_valentina"),
|
||||||
QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
|
QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder))
|
||||||
{
|
{
|
||||||
QFAIL("Fail to prepare test files for testing.");
|
QFAIL("Fail to prepare test files for testing.");
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,9 @@ void TST_ValentinaCommandLine::initTestCase()
|
||||||
QFAIL("Fail to remove collection temp directory.");
|
QFAIL("Fail to remove collection temp directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not CopyRecursively(QApplication::applicationDirPath() + QDir::separator() +
|
if (not CopyRecursively(QCoreApplication::applicationDirPath() + QDir::separator() +
|
||||||
QLatin1String("tst_valentina_collection"),
|
QLatin1String("tst_valentina_collection"),
|
||||||
QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder))
|
QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder))
|
||||||
{
|
{
|
||||||
QFAIL("Fail to prepare collection files for testing.");
|
QFAIL("Fail to prepare collection files for testing.");
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ void TST_ValentinaCommandLine::OpenPatterns()
|
||||||
QFETCH(int, exitCode);
|
QFETCH(int, exitCode);
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
||||||
const int exit = Run(exitCode, ValentinaPath(), QStringList() << "--test"
|
const int exit = Run(exitCode, ValentinaPath(), QStringList() << "--test"
|
||||||
<< tmp + QDir::separator() + file, error);
|
<< tmp + QDir::separator() + file, error);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void TST_ValentinaCommandLine::ExportMode_data() const
|
||||||
QTest::addColumn<QString>("arguments");
|
QTest::addColumn<QString>("arguments");
|
||||||
QTest::addColumn<int>("exitCode");
|
QTest::addColumn<int>("exitCode");
|
||||||
|
|
||||||
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
||||||
|
|
||||||
QTest::newRow("Issue #372")<< "issue_372.val"
|
QTest::newRow("Issue #372")<< "issue_372.val"
|
||||||
<< QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp)
|
<< QString("-p;;0;;-d;;%1;;-b;;output").arg(tmp)
|
||||||
|
@ -155,7 +155,7 @@ void TST_ValentinaCommandLine::ExportMode()
|
||||||
QFETCH(int, exitCode);
|
QFETCH(int, exitCode);
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
||||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
||||||
<< arguments.split(";;");
|
<< arguments.split(";;");
|
||||||
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
||||||
|
@ -170,7 +170,7 @@ void TST_ValentinaCommandLine::TestMode_data() const
|
||||||
QTest::addColumn<QString>("arguments");
|
QTest::addColumn<QString>("arguments");
|
||||||
QTest::addColumn<int>("exitCode");
|
QTest::addColumn<int>("exitCode");
|
||||||
|
|
||||||
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
||||||
|
|
||||||
QTest::newRow("Issue #256. Correct path.")<< "issue_256.val"
|
QTest::newRow("Issue #256. Correct path.")<< "issue_256.val"
|
||||||
<< QString("--test")
|
<< QString("--test")
|
||||||
|
@ -213,7 +213,7 @@ void TST_ValentinaCommandLine::TestMode()
|
||||||
QFETCH(int, exitCode);
|
QFETCH(int, exitCode);
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestFolder;
|
||||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
||||||
<< arguments.split(";;");
|
<< arguments.split(";;");
|
||||||
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
||||||
|
@ -228,7 +228,7 @@ void TST_ValentinaCommandLine::TestOpenCollection_data() const
|
||||||
QTest::addColumn<QString>("arguments");
|
QTest::addColumn<QString>("arguments");
|
||||||
QTest::addColumn<int>("exitCode");
|
QTest::addColumn<int>("exitCode");
|
||||||
|
|
||||||
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
|
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
|
||||||
const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst"));
|
const QString testGOST = QString("--test;;-m;;%1").arg(tmp + QDir::separator() + QLatin1String("GOST_man_ru.vst"));
|
||||||
const QString keyTest = QStringLiteral("--test");
|
const QString keyTest = QStringLiteral("--test");
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ void TST_ValentinaCommandLine::TestOpenCollection()
|
||||||
QFETCH(int, exitCode);
|
QFETCH(int, exitCode);
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
const QString tmp = QApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
|
const QString tmp = QCoreApplication::applicationDirPath() + QDir::separator() + tmpTestCollectionFolder;
|
||||||
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
const QStringList arg = QStringList() << tmp + QDir::separator() + file
|
||||||
<< arguments.split(";;");
|
<< arguments.split(";;");
|
||||||
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
const int exit = Run(exitCode, ValentinaPath(), arg, error);
|
||||||
|
|
|
@ -94,32 +94,32 @@ void TST_Misc::TestAbsoluteFilePath_data()
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
QTest::newRow("Measurements one level above")
|
QTest::newRow("Measurements one level above")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
||||||
<< "../measurements/m.vit"
|
<< "../measurements/m.vit"
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/measurements/m.vit");
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/measurements/m.vit");
|
||||||
QTest::newRow("Measurements one level above")
|
QTest::newRow("Measurements one level above")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
||||||
<< "../measurements/m.vit"
|
<< "../measurements/m.vit"
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/measurements/m.vit");
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/measurements/m.vit");
|
||||||
|
|
||||||
QTest::newRow("Measurements one level under")
|
QTest::newRow("Measurements one level under")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
||||||
<< "measurements/m.vit"
|
<< "measurements/m.vit"
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/measurements/m.vit");
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/measurements/m.vit");
|
||||||
|
|
||||||
QTest::newRow("Measurements in the same folder")
|
QTest::newRow("Measurements in the same folder")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
||||||
<< "m.vit"
|
<< "m.vit"
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/m.vit");
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/m.vit");
|
||||||
|
|
||||||
QTest::newRow("Path to measurements is empty")
|
QTest::newRow("Path to measurements is empty")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
||||||
<< "" << "";
|
<< "" << "";
|
||||||
|
|
||||||
QTest::newRow("Path to a pattern file is empty. Ablosute measurements path.")
|
QTest::newRow("Path to a pattern file is empty. Ablosute measurements path.")
|
||||||
<< ""
|
<< ""
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/m.vit")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/m.vit")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/m.vit");
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/m.vit");
|
||||||
|
|
||||||
QTest::newRow("Path to a pattern file is empty. Relative measurements path.")
|
QTest::newRow("Path to a pattern file is empty. Relative measurements path.")
|
||||||
<< ""
|
<< ""
|
||||||
|
@ -127,21 +127,21 @@ void TST_Misc::TestAbsoluteFilePath_data()
|
||||||
<< "measurements/m.vit";
|
<< "measurements/m.vit";
|
||||||
|
|
||||||
QTest::newRow("Relative measurements path.")
|
QTest::newRow("Relative measurements path.")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
||||||
<< "../measurements/m.vit"
|
<< "../measurements/m.vit"
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/measurements/m.vit");
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/measurements/m.vit");
|
||||||
|
|
||||||
QTest::newRow("Both paths are empty") << "" << "" << "";
|
QTest::newRow("Both paths are empty") << "" << "" << "";
|
||||||
|
|
||||||
QTest::newRow("Path to measurements is relative")
|
QTest::newRow("Path to measurements is relative")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/pattern.val")
|
||||||
<< "m.vit"
|
<< "m.vit"
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/m.vit");
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns/m.vit");
|
||||||
|
|
||||||
QTest::newRow("Absolute pattern path.")
|
QTest::newRow("Absolute pattern path.")
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/patterns")
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/patterns")
|
||||||
<< "m.vit"
|
<< "m.vit"
|
||||||
<< QApplication::applicationDirPath() + QStringLiteral("/home/user/m.vit");
|
<< QCoreApplication::applicationDirPath() + QStringLiteral("/home/user/m.vit");
|
||||||
#else
|
#else
|
||||||
QTest::newRow("Measurements one level above")
|
QTest::newRow("Measurements one level above")
|
||||||
<< "/home/user/patterns/pattern.val" << "../measurements/m.vit" << "/home/user/measurements/m.vit";
|
<< "/home/user/patterns/pattern.val" << "../measurements/m.vit" << "/home/user/measurements/m.vit";
|
||||||
|
|
|
@ -44,7 +44,7 @@ TST_VLockGuard::TST_VLockGuard(QObject *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TST_VLockGuard::TryLock() const
|
void TST_VLockGuard::TryLock() const
|
||||||
{
|
{
|
||||||
QString fileName(QApplication::applicationDirPath() + "/lockFile.txt");
|
QString fileName(QCoreApplication::applicationDirPath() + "/lockFile.txt");
|
||||||
std::shared_ptr<VLockGuard<char>> lock;
|
std::shared_ptr<VLockGuard<char>> lock;
|
||||||
VlpCreateLock(lock, fileName);
|
VlpCreateLock(lock, fileName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user