Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests in view for the new plot options #43

Merged
merged 10 commits into from
Feb 17, 2025
2 changes: 1 addition & 1 deletion src/hyspecppt/hppt/experiment_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
alpha + subscript_s,
"cos" + square + alpha + subscript_s,
"(1+cos" + square + alpha + subscript_s + ")/2",
"(cos" + square + alpha + subscript_s + "-sin" + square + alpha + subscript_s + ")",
"cos" + square + alpha + subscript_s + "-sin" + square + alpha + subscript_s,
]

# default parameters
Expand Down
23 changes: 23 additions & 0 deletions tests/hppt_view/test_basegui.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,26 @@ def test_selector_widget(qtbot):

assert selector_widget.powder_rb.text() == "Po&wder"
assert selector_widget.sc_rb.text() == "Single C&rystal"


def test_combo_box_plot_options():
"""Test the combo box text are set correctly"""
# unicode
alpha = "\u03b1"
square = "\u00b2"
subscript_s = "\u209b"

ExpWidget = hppt_view.ExperimentWidget()
ExpWidget.initializeCombo(PLOT_TYPES)
assert ExpWidget.Type_combobox.currentText() == alpha + subscript_s
ExpWidget.Type_combobox.setCurrentIndex(1)
assert ExpWidget.Type_combobox.currentText() == "cos" + square + alpha + subscript_s

ExpWidget.Type_combobox.setCurrentIndex(2)
assert ExpWidget.Type_combobox.currentText() == "(1+cos" + square + alpha + subscript_s + ")/2"

ExpWidget.Type_combobox.setCurrentIndex(3)
assert (
ExpWidget.Type_combobox.currentText()
== "cos" + square + alpha + subscript_s + "-sin" + square + alpha + subscript_s
)