mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2577 Test : Add test toolbar to launch unit tests and regression tests
This commit is contained in:
@@ -72,6 +72,8 @@ RiaPreferences::RiaPreferences(void)
|
||||
appendClassNameToUiText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
CAF_PDM_InitField(&appendFieldKeywordToToolTipText, "appendFieldKeywordToToolTipText", false, "Show Field Keyword in ToolTip", "", "", "");
|
||||
appendFieldKeywordToToolTipText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
CAF_PDM_InitField(&showTestToolbar, "showTestToolbar", false, "Enable Test Toolbar", "", "", "");
|
||||
showTestToolbar.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
CAF_PDM_InitField(&includeFractureDebugInfoFile, "includeFractureDebugInfoFile", false, "Include Fracture Debug Info for Completion Export", "", "", "");
|
||||
includeFractureDebugInfoFile.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
|
||||
|
||||
@@ -124,6 +126,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
|
||||
field == &showHud ||
|
||||
field == &appendClassNameToUiText ||
|
||||
field == &appendFieldKeywordToToolTipText ||
|
||||
field == &showTestToolbar ||
|
||||
field == &includeFractureDebugInfoFile ||
|
||||
field == &showLasCurveWithoutTvdWarning)
|
||||
{
|
||||
@@ -184,6 +187,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
{
|
||||
uiOrdering.add(&appendClassNameToUiText);
|
||||
uiOrdering.add(&appendFieldKeywordToToolTipText);
|
||||
uiOrdering.add(&showTestToolbar);
|
||||
uiOrdering.add(&includeFractureDebugInfoFile);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ public: // Pdm Fields
|
||||
caf::PdmField<bool> showHud;
|
||||
caf::PdmField<bool> appendClassNameToUiText;
|
||||
caf::PdmField<bool> appendFieldKeywordToToolTipText;
|
||||
caf::PdmField<bool> showTestToolbar;
|
||||
caf::PdmField<bool> includeFractureDebugInfoFile;
|
||||
|
||||
caf::PdmField<QString> lastUsedProjectFileName;
|
||||
|
||||
@@ -13,6 +13,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCloseProjectFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHelpFeatures.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicLaunchRegressionTestsFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -29,6 +30,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCloseProjectFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicHelpFeatures.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicLaunchRegressionTestsFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicLaunchRegressionTestsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaRegressionTest.h"
|
||||
|
||||
#include "cafPdmSettings.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicLaunchRegressionTestsFeature, "RicLaunchRegressionTestsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicLaunchRegressionTestsFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLaunchRegressionTestsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaRegressionTest regTestConfig;
|
||||
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(®TestConfig);
|
||||
|
||||
QStringList testFilter = regTestConfig.testFilter().split(";", QString::SkipEmptyParts);
|
||||
|
||||
// Launch regression test using the current test folder and test filter
|
||||
RiaApplication::instance()->executeRegressionTests(regTestConfig.regressionTestFolder, &testFilter);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicLaunchRegressionTestsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Launch Regression Tests");
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicLaunchRegressionTestsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
private:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
void setupActionLook(QAction* actionToSetup) override;
|
||||
};
|
||||
@@ -536,6 +536,15 @@ void RiuMainWindow::createToolBars()
|
||||
dsToolBar->addAction(m_showWellCellsAction);
|
||||
}
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if (app->preferences()->showTestToolbar())
|
||||
{
|
||||
QToolBar* toolbar = addToolBar(tr("Test"));
|
||||
toolbar->setObjectName(toolbar->windowTitle());
|
||||
toolbar->addAction(cmdFeatureMgr->action("RicLaunchUnitTestsFeature"));
|
||||
toolbar->addAction(cmdFeatureMgr->action("RicLaunchRegressionTestsFeature"));
|
||||
}
|
||||
|
||||
// Create animation toolbar
|
||||
m_animationToolBar = new caf::AnimationToolBar("Animation", this);
|
||||
addToolBar(m_animationToolBar);
|
||||
|
||||
Reference in New Issue
Block a user