Files
ResInsight/ApplicationLibCode/FeatureTests/RiaFeatureTestModelBuilder.h
T
Magne Sjaastad 7fa9d0c5bf #14741 Add command-feature test infrastructure
Add the ResInsight-featuretests executable: a headless GUI test harness (RiaFeatureTestModelBuilder, RiaFeatureTestTreeView), a runner that triggers Ric*Feature commands through their QAction (RicFeatureExecutionRunner), a generic execution sweep over every registered feature (RicFeatureSweep-Test, RicFeatureExecutionSweep-Test, RicFeatureSubprocessSweep-Test, RicFeatureSweepDenylist), and supporting CMake wiring. Adds RiaRegressionTestRunner::setRunningRegressionTests() so tests can suppress modal dialogs, and shares RimMockSummaryCase as a common test model under TestModels.
2026-09-15 08:15:59 -04:00

75 lines
3.1 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026 Equinor 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
class RimEclipseCase;
class RimGeoMechCase;
class RimGridView;
class RimPolygon;
class RimSummaryCase;
class RimWellPath;
//==================================================================================================
/// Builds small in-memory projects used by the command-feature tests.
///
/// The builders start from a clean project (RiaApplication::closeProject) and populate it with the
/// objects a feature scenario needs, returning pointers into the live project so the caller can set
/// the current caf::SelectionManager selection.
//==================================================================================================
struct FeatureTestModel
{
RimEclipseCase* eclipseCase = nullptr;
RimGridView* eclipseView = nullptr;
RimWellPath* wellPath = nullptr;
RimSummaryCase* summaryCase = nullptr;
RimGeoMechCase* geoMechCase = nullptr;
RimGridView* geoMechView = nullptr;
RimPolygon* polygon = nullptr;
};
class RiaFeatureTestModelBuilder
{
public:
// Close the current project, leaving an empty project in place.
static void closeProject();
// A mock Eclipse case with results and a 3D view (via RiaImportEclipseCaseTools::openMockModel).
static FeatureTestModel eclipseCaseWithResults();
// A single well path added to the active oil field's well path collection.
static FeatureTestModel wellPath();
// A single project containing both a mock Eclipse case (with a 3D view) and a well path, so the
// sweep can select different object types without rebuilding the (expensive) Eclipse model.
static FeatureTestModel combinedModel();
// An in-memory summary case (RimMockSummaryCase) with a single field vector, added to the active
// oil field's summary case main collection. No .SMSPEC file is read.
static FeatureTestModel summaryCase();
// A GeoMech case with a 3D view, loaded from the small VTK (.pvd) model in the unit test data.
// The view is made the active reservoir view. Returns an empty model if the case fails to load.
static FeatureTestModel geoMechCase();
// Everything above in one project: Eclipse case and view, well path, summary case, GeoMech case
// and view, and a polygon. Used by the execution sweep so features from every domain find a
// selection they accept. The Eclipse view is left as the active reservoir view.
static FeatureTestModel richModel();
};