mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
#14524 Histogram: Reset user-defined bin range on property change
A user-defined bin range is tied to the value range of a specific result: a range set up for FLUXNUM does not apply to PERMX. Reset the bin range mode to Automatic and the min/max cutoffs to their defaults when another property is selected, and reset the stale cutoffs when the user sets the bin range mode back to Automatic.
This commit is contained in:
1 parent
5f465bf19a
commit
05588f4327
5 files changed
+51
-7
No files matched your search
@@ -260,3 +260,28 @@ TEST( RimHistogramDataSourceTest, BinningModeForResult )
|
||||
EXPECT_EQ( RigHistogramCalculator::BinningMode::LINEAR, RimGridStatisticsHistogramDataSource::binningModeForResult( "FLUXNUM" ) );
|
||||
EXPECT_EQ( RigHistogramCalculator::BinningMode::LINEAR, RimGridStatisticsHistogramDataSource::binningModeForResult( "" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( RimHistogramDataSourceTest, ResetBinRange )
|
||||
{
|
||||
RimGridStatisticsHistogramDataSource dataSource;
|
||||
|
||||
auto* binRangeMode =
|
||||
dynamic_cast<caf::PdmField<caf::AppEnum<RimHistogramDataSource::BinRangeMode>>*>( dataSource.findField( "BinRangeMode" ) );
|
||||
auto* binRangeMin = dynamic_cast<caf::PdmField<double>*>( dataSource.findField( "BinRangeMin" ) );
|
||||
auto* binRangeMax = dynamic_cast<caf::PdmField<double>*>( dataSource.findField( "BinRangeMax" ) );
|
||||
ASSERT_TRUE( binRangeMode && binRangeMin && binRangeMax );
|
||||
|
||||
*binRangeMode = RimHistogramDataSource::BinRangeMode::USER_DEFINED;
|
||||
*binRangeMin = 0.2;
|
||||
*binRangeMax = 0.8;
|
||||
EXPECT_FALSE( dataSource.filterDescriptions().empty() );
|
||||
|
||||
dataSource.resetBinRange();
|
||||
|
||||
EXPECT_TRUE( dataSource.filterDescriptions().empty() );
|
||||
EXPECT_DOUBLE_EQ( 0.0, binRangeMin->value() );
|
||||
EXPECT_DOUBLE_EQ( 1.0, binRangeMax->value() );
|
||||
}
|
||||
Reference in new issue
Block a user