fixed more test keys

This commit is contained in:
anhefti 2022-02-02 13:35:13 +01:00
parent 270d7a2282
commit c66a59223e
6 changed files with 28 additions and 31 deletions

View file

@ -46,6 +46,7 @@ public class CheckboxFieldBuilder extends FieldBuilder<String> {
SWT.CHECK, SWT.CHECK,
this.label, this.label,
this.tooltip, this.tooltip,
this.label.name,
getARIALabel(builder)); getARIALabel(builder));
} else { } else {
titleLabel = createTitleLabel(builder.formParent, builder, this); titleLabel = createTitleLabel(builder.formParent, builder, this);
@ -55,6 +56,7 @@ public class CheckboxFieldBuilder extends FieldBuilder<String> {
SWT.CHECK, SWT.CHECK,
null, null,
null, null,
this.label.name,
getARIALabel(builder)); getARIALabel(builder));
} }

View file

@ -121,9 +121,9 @@ public final class TextFieldBuilder extends FieldBuilder<String> {
final String testKey = (this.label != null) ? this.label.name : this.name; final String testKey = (this.label != null) ? this.label.name : this.name;
final LocTextKey label = getARIALabel(builder); final LocTextKey label = getARIALabel(builder);
final Text textInput = (this.isNumber) final Text textInput = (this.isNumber)
? builder.widgetFactory.numberInput(fieldGrid, this.numberCheck, readonly, label) ? builder.widgetFactory.numberInput(fieldGrid, this.numberCheck, readonly, testKey, label)
: (this.isArea) : (this.isArea)
? builder.widgetFactory.textAreaInput(fieldGrid, readonly, label) ? builder.widgetFactory.textAreaInput(fieldGrid, readonly, testKey, label)
: builder.widgetFactory.textInput(fieldGrid, this.isPassword, readonly, testKey, label); : builder.widgetFactory.textInput(fieldGrid, this.isPassword, readonly, testKey, label);
if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) {

View file

@ -22,8 +22,11 @@ import ch.ethz.seb.sebserver.gbl.model.sebconfig.AttributeType;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation; import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation;
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService;
import ch.ethz.seb.sebserver.gui.service.examconfig.InputField; import ch.ethz.seb.sebserver.gui.service.examconfig.InputField;
import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder;
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
@Lazy @Lazy
@Component @Component
@ -48,6 +51,7 @@ public class SliderFieldBuilder implements InputFieldBuilder {
final ConfigurationAttribute attribute, final ConfigurationAttribute attribute,
final ViewContext viewContext) { final ViewContext viewContext) {
final I18nSupport i18nSupport = viewContext.getI18nSupport();
final Orientation orientation = viewContext final Orientation orientation = viewContext
.getOrientation(attribute.id); .getOrientation(attribute.id);
final Composite innerGrid = InputFieldBuilder final Composite innerGrid = InputFieldBuilder
@ -55,6 +59,9 @@ public class SliderFieldBuilder implements InputFieldBuilder {
final Slider slider = new Slider(innerGrid, SWT.NONE); final Slider slider = new Slider(innerGrid, SWT.NONE);
slider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); slider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute);
WidgetFactory.setTestId(slider, attributeNameKey);
WidgetFactory.setARIALabel(slider, i18nSupport.getText(attributeNameKey));
try { try {
final String[] split = StringUtils.split( final String[] split = StringUtils.split(

View file

@ -154,6 +154,8 @@ public final class ThresholdList extends Composite {
Double.parseDouble(s); Double.parseDouble(s);
} }
}, },
false,
VALUE_TEXT_KEY.name + "_" + this.thresholds.size(),
VALUE_TEXT_KEY); VALUE_TEXT_KEY);
final GridData valueCell = new GridData(SWT.FILL, SWT.CENTER, true, false); final GridData valueCell = new GridData(SWT.FILL, SWT.CENTER, true, false);
valueInput.setLayoutData(valueCell); valueInput.setLayoutData(valueCell);

View file

@ -399,27 +399,6 @@ public class WidgetFactory {
return button; return button;
} }
public Button buttonLocalized(
final Composite parent,
final int type,
final LocTextKey locTextKey,
final LocTextKey toolTipKey,
final LocTextKey ariaLabel) {
final Button button = new Button(parent, type);
setARIARole(button, AriaRole.button);
if (ariaLabel != null) {
setARIALabel(button, this.i18nSupport.getText(ariaLabel));
}
if (locTextKey != null) {
setTestId(button, locTextKey.name);
} else if (toolTipKey != null) {
setTestId(button, toolTipKey.name);
}
this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey);
return button;
}
public Button buttonLocalized( public Button buttonLocalized(
final Composite parent, final Composite parent,
final int type, final int type,
@ -518,7 +497,6 @@ public class WidgetFactory {
return textInput; return textInput;
} }
//
public Text passwordInput(final Composite content, final String testKey, final LocTextKey ariaLabel) { public Text passwordInput(final Composite content, final String testKey, final LocTextKey ariaLabel) {
return textInput(content, true, false, testKey, ariaLabel); return textInput(content, true, false, testKey, ariaLabel);
} }
@ -526,6 +504,7 @@ public class WidgetFactory {
public Text textAreaInput( public Text textAreaInput(
final Composite content, final Composite content,
final boolean readonly, final boolean readonly,
final String testKey,
final LocTextKey ariaLabel) { final LocTextKey ariaLabel) {
final Text input = readonly final Text input = readonly
@ -534,6 +513,9 @@ public class WidgetFactory {
if (ariaLabel != null) { if (ariaLabel != null) {
WidgetFactory.setARIALabel(input, this.i18nSupport.getText(ariaLabel)); WidgetFactory.setARIALabel(input, this.i18nSupport.getText(ariaLabel));
} }
if (testKey != null) {
setTestId(input, testKey);
}
return input; return input;
} }
@ -559,20 +541,23 @@ public class WidgetFactory {
return input; return input;
} }
public Text numberInput(final Composite content, final Consumer<String> numberCheck, final LocTextKey label) { // public Text numberInput(final Composite content, final Consumer<String> numberCheck, final LocTextKey label) {
return numberInput(content, numberCheck, false, label); // return numberInput(content, numberCheck, false, label);
} // }
public Text numberInput( public Text numberInput(
final Composite content, final Composite content,
final Consumer<String> numberCheck, final Consumer<String> numberCheck,
final boolean readonly, final boolean readonly,
final LocTextKey label) { final String testKey,
final LocTextKey ariaLabel) {
final Text numberInput = new Text(content, (readonly) ? SWT.LEFT | SWT.READ_ONLY : SWT.RIGHT | SWT.BORDER); final Text numberInput = new Text(content, (readonly) ? SWT.LEFT | SWT.READ_ONLY : SWT.RIGHT | SWT.BORDER);
if (label != null) { if (ariaLabel != null) {
setARIALabel(numberInput, this.i18nSupport.getText(label)); setARIALabel(numberInput, this.i18nSupport.getText(ariaLabel));
setTestId(numberInput, label.name); }
if (testKey != null) {
setTestId(numberInput, testKey);
} }
if (numberCheck != null) { if (numberCheck != null) {
numberInput.addListener(SWT.Verify, event -> { numberInput.addListener(SWT.Verify, event -> {

View file

@ -975,6 +975,7 @@ sebserver.examconfig.props.label.audioControlEnabled=Enable audio controls
sebserver.examconfig.props.label.audioControlEnabled.tooltip=Displays an audio control in the SEB taskbar sebserver.examconfig.props.label.audioControlEnabled.tooltip=Displays an audio control in the SEB taskbar
sebserver.examconfig.props.label.audioMute=Mute audio on startup sebserver.examconfig.props.label.audioMute=Mute audio on startup
sebserver.examconfig.props.label.audioMute.tooltip=The audio is muted when the SEB/exam starts sebserver.examconfig.props.label.audioMute.tooltip=The audio is muted when the SEB/exam starts
sebserver.examconfig.props.label.audioVolumeLevel=Set initial volume level
sebserver.examconfig.props.label.audioSetVolumeLevel=Set initial volume level sebserver.examconfig.props.label.audioSetVolumeLevel=Set initial volume level
sebserver.examconfig.props.label.audioSetVolumeLevel.tooltip=The volume level after starting SEB/exam sebserver.examconfig.props.label.audioSetVolumeLevel.tooltip=The volume level after starting SEB/exam