Feature #2331

Unit labels

Added by juan 8 months ago. Updated 6 months ago.

Status:ResolvedStart date:25 Mar 2019
Priority:NormalDue date:
Assignee:juan% Done:

0%

Category:-
Target version:Sprint 41

Description

Several users (ESS and IFF Spring School 2019) would find it useful to include units in places where values need to be given in the BornAgain GUI (not only in the tooltips).

UnitLabels.png (105 KB) juan, 25 Mar 2019 14:20

UnitLabels2.png (114 KB) juan, 25 Mar 2019 14:24

gitDiff.txt Magnifier (45.9 KB) juan, 08 May 2019 16:55

Changeset_produce_unit_test_to_fail.png (113 KB) juan, 09 May 2019 15:00

History

#1 Updated by juan 6 months ago

In trying to solve issue http://apps.jcns.fz-juelich.de/redmine/issues/2331, I have added units (like this: "[nm]") to the form factor parameters. This resulted in a larger-than-expected modification to the code and some tests already failed. I managed to fix them, but who know what else will explode later. My belief is that many bugs could potentially be introduced by this seemingly irrelevant change --See attached output of git diff.

The other part was done without hiccups --now the detector parameters have units on them; I'm creating a Pull Request shortly and mark the issue as solved as soon as the PR gets accepted.

#2 Updated by juan 6 months ago

The pull request containing the feature illustrated by "UnitLabels.png" was accepted. Marking this issue as resolved.

On trying to implement the feature illustrated by "UnitLabels2.png" above, I used a different approach, still unit tests are failing:

[----------] 3 tests from TestParameterTreeUtils
[ RUN ] TestParameterTreeUtils.test_parameterTreeNames
/source/Tests/UnitTests/GUI/TestParameterTreeUtils.cpp:36: Failure
Expected: ParameterTreeUtils::parameterTreeNames(layer)
Which is: { { 2-byte object <4C-00>, 2-byte object <61-00>, 2-byte object <79-00>, 2-byte object <65-00>, 2-byte object <72-00>, 2-byte object <2F-00>, 2-byte object <54-00>, 2-byte object <68-00>, 2-byte object <69-00>, 2-byte object <63-00>, 2-byte object <6B-00>, 2-byte object <6E-00>, 2-byte object <65-00>, 2-byte object <73-00>, 2-byte object <73-00>, 2-byte object <20-00>, 2-byte object <5B-00>, 2-byte object <6E-00>, 2-byte object <6D-00>, 2-byte object <5D-00> } }
To be equal to: QStringList() << "Layer/Thickness"
Which is: { { 2-byte object <4C-00>, 2-byte object <61-00>, 2-byte object <79-00>, 2-byte object <65-00>, 2-byte object <72-00>, 2-byte object <2F-00>, 2-byte object <54-00>, 2-byte object <68-00>, 2-byte object <69-00>, 2-byte object <63-00>, 2-byte object <6B-00>, 2-byte object <6E-00>, 2-byte object <65-00>, 2-byte object <73-00>, 2-byte object <73-00> } }
[ FAILED ] TestParameterTreeUtils.test_parameterTreeNames (1 ms)
[ RUN ] TestParameterTreeUtils.test_parameterTranslatedNames
[ OK ] TestParameterTreeUtils.test_parameterTranslatedNames (1 ms)
[ RUN ] TestParameterTreeUtils.test_linkItemFromParameterName
[ OK ] TestParameterTreeUtils.test_linkItemFromParameterName (1 ms)
[----------] 3 tests from TestParameterTreeUtils (3 ms total)

The approach taken was to use the function setDisplayName, the change was minimal and unit tests are already failing (See png attached - "Changeset_produce_unit_test_to_fail.png").

#3 Updated by juan 6 months ago

  • Assignee set to juan
  • Target version set to Sprint 41

Also available in: Atom PDF