#2577 Test : Add test toolbar to launch unit tests and regression tests

This commit is contained in:
Magne Sjaastad
2018-03-06 13:18:39 +01:00
parent ec96edf266
commit 2435e92be1
6 changed files with 110 additions and 0 deletions

View File

@@ -72,6 +72,8 @@ RiaPreferences::RiaPreferences(void)
appendClassNameToUiText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); appendClassNameToUiText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&appendFieldKeywordToToolTipText, "appendFieldKeywordToToolTipText", false, "Show Field Keyword in ToolTip", "", "", ""); CAF_PDM_InitField(&appendFieldKeywordToToolTipText, "appendFieldKeywordToToolTipText", false, "Show Field Keyword in ToolTip", "", "", "");
appendFieldKeywordToToolTipText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); 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", "", "", ""); CAF_PDM_InitField(&includeFractureDebugInfoFile, "includeFractureDebugInfoFile", false, "Include Fracture Debug Info for Completion Export", "", "", "");
includeFractureDebugInfoFile.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); includeFractureDebugInfoFile.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
@@ -124,6 +126,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
field == &showHud || field == &showHud ||
field == &appendClassNameToUiText || field == &appendClassNameToUiText ||
field == &appendFieldKeywordToToolTipText || field == &appendFieldKeywordToToolTipText ||
field == &showTestToolbar ||
field == &includeFractureDebugInfoFile || field == &includeFractureDebugInfoFile ||
field == &showLasCurveWithoutTvdWarning) field == &showLasCurveWithoutTvdWarning)
{ {
@@ -184,6 +187,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
{ {
uiOrdering.add(&appendClassNameToUiText); uiOrdering.add(&appendClassNameToUiText);
uiOrdering.add(&appendFieldKeywordToToolTipText); uiOrdering.add(&appendFieldKeywordToToolTipText);
uiOrdering.add(&showTestToolbar);
uiOrdering.add(&includeFractureDebugInfoFile); uiOrdering.add(&includeFractureDebugInfoFile);
} }

View File

@@ -68,6 +68,7 @@ public: // Pdm Fields
caf::PdmField<bool> showHud; caf::PdmField<bool> showHud;
caf::PdmField<bool> appendClassNameToUiText; caf::PdmField<bool> appendClassNameToUiText;
caf::PdmField<bool> appendFieldKeywordToToolTipText; caf::PdmField<bool> appendFieldKeywordToToolTipText;
caf::PdmField<bool> showTestToolbar;
caf::PdmField<bool> includeFractureDebugInfoFile; caf::PdmField<bool> includeFractureDebugInfoFile;
caf::PdmField<QString> lastUsedProjectFileName; caf::PdmField<QString> lastUsedProjectFileName;

View File

@@ -13,6 +13,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCloseProjectFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicHelpFeatures.h ${CMAKE_CURRENT_LIST_DIR}/RicHelpFeatures.h
${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicLaunchRegressionTestsFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES 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}/RicHelpFeatures.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicLaunchRegressionTestsFeature.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@@ -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(&regTestConfig);
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");
}

View File

@@ -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;
};

View File

@@ -536,6 +536,15 @@ void RiuMainWindow::createToolBars()
dsToolBar->addAction(m_showWellCellsAction); 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 // Create animation toolbar
m_animationToolBar = new caf::AnimationToolBar("Animation", this); m_animationToolBar = new caf::AnimationToolBar("Animation", this);
addToolBar(m_animationToolBar); addToolBar(m_animationToolBar);