Skip to content

Commit

Permalink
#436 more UI automated testing
Browse files Browse the repository at this point in the history
  • Loading branch information
davetcc committed Dec 31, 2023
1 parent c4581e9 commit a2b037b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tcMenuGenerator/scripts/packager-all-platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Drop to a command-line, in the tcMenu/tcMenuGenerator directory and run a maven

Run and smoke test, ensure you are in the tcMenuGenerator/target/jfx/app directory:

java --module-path ../deps "-Dprism.lcdtext=false" --add-modules com.thecoderscorner.tcmenu.menuEditorUI com.thecoderscorner.menu.editorui.cli.TcMenuDesignerCmd
java --module-path ../deps "-Dprism.lcdtext=false" "-Doverride.core.plugin.dir=." --add-modules com.thecoderscorner.tcmenu.menuEditorUI com.thecoderscorner.menu.editorui.cli.TcMenuDesignerCmd

## Packaging - Build the package - Windows all versions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ protected Optional<EnumMenuItem> getChangedMenuItem() {
errors.add(new FieldError(bundle.getString("menu.editor.enum.fmt.error"), "Choices"));
}

if(localHandler.isLocalSupportEnabled()) {
checkListValuesAreInResources(listView.getItems(), errors);
}

EnumMenuItemBuilder builder = EnumMenuItemBuilder.anEnumMenuItemBuilder().withExisting(getMenuItem());
builder.withEnumList(items);
getChangedDefaults(builder, errors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,5 +644,15 @@ public String toString() {
}
}

protected void checkListValuesAreInResources(ObservableList<String> items, List<FieldError> errors) {
var itemsNotInResources = items.stream()
.filter(item -> item.startsWith("%") && !item.startsWith("%%") && item.length() > 1)
.filter(item -> localHandler.getLocalSpecificEntry(item.substring(1)) == null)
.collect(Collectors.joining(", "));
errors.add(new FieldError(bundle.getString("menu.editor.core.locale.missing") + " " + itemsNotInResources,
"List values", false));
}


public record ControlButtons(Button addButton, Button removeButton) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.List;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;

import static com.thecoderscorner.menu.domain.RuntimeListMenuItem.ListCreationMode;

Expand Down Expand Up @@ -62,12 +61,7 @@ protected Optional<RuntimeListMenuItem> getChangedMenuItem() {
}

if(creationModeCombo.getValue() != ListCreationMode.CUSTOM_RTCALL && localHandler.isLocalSupportEnabled()) {
var itemsNotInResources = listView.getItems().stream()
.filter(item -> item.startsWith("%") && !item.startsWith("%%") && item.length() > 1)
.filter(item -> localHandler.getLocalSpecificEntry(item.substring(1)) == null)
.collect(Collectors.joining(", "));
errors.add(new FieldError(bundle.getString("menu.editor.core.locale.missing") + " " + itemsNotInResources,
"List values", false));
checkListValuesAreInResources(listView.getItems(), errors);
}

builder.withInitialRows(initialRowsSpinner.getValue());
Expand Down

0 comments on commit a2b037b

Please sign in to comment.