From d218b93a535085c85889164d45a83c3a519f9f4b Mon Sep 17 00:00:00 2001 From: Henri Chain Date: Tue, 18 Feb 2020 23:21:30 +0100 Subject: Fix code generation for entries with min/max Summary: - When GenerateProperties and Mutators are activated, the generated code did not handle min/max properly - In the case of a parameterized entry, generated code also did not handle min/max BUG: 418146 Test Plan: - auto tests included Reviewers: meven, crossi, ervin, bport, tcanabrava Reviewed By: meven, ervin Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27497 --- autotests/kconfig_compiler/test_param_minmax.h.ref | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 autotests/kconfig_compiler/test_param_minmax.h.ref (limited to 'autotests/kconfig_compiler/test_param_minmax.h.ref') diff --git a/autotests/kconfig_compiler/test_param_minmax.h.ref b/autotests/kconfig_compiler/test_param_minmax.h.ref new file mode 100644 index 00000000..3cc8717c --- /dev/null +++ b/autotests/kconfig_compiler/test_param_minmax.h.ref @@ -0,0 +1,64 @@ +// This file is generated by kconfig_compiler_kf5 from test_param_minmax.kcfg. +// All changes you do to this file will be lost. +#ifndef TESTPARAMMINMAX_H +#define TESTPARAMMINMAX_H + +#include +#include +#include +#include + +class TestParamMinMax : public KConfigSkeleton +{ + public: + + TestParamMinMax( KSharedConfig::Ptr config = KSharedConfig::openConfig() ); + ~TestParamMinMax(); + + /** + Set foo_#$(myparam) + */ + void setFoo( int i, double v ) + { + if (v < 0.01) + { + qDebug() << "setFoo: value " << v << " is less than the minimum value of 0.01"; + v = 0.01; + } + + if (v > 89898.23) + { + qDebug() << "setFoo: value " << v << " is greater than the maximum value of 89898.23"; + v = 89898.23; + } + + if (!isFooImmutable( i )) + mFoo[i] = v; + } + + /** + Get foo_#$(myparam) + */ + double foo( int i ) const + { + return mFoo[i]; + } + + /** + Is foo_#$(myparam) Immutable + */ + bool isFooImmutable( int i ) const + { + return isImmutable( QStringLiteral( "Foo%1" ).arg( i ) ); + } + + protected: + + // Something + double mFoo[6]; + + private: +}; + +#endif + -- cgit v1.2.1