Skip to content

Commit

Permalink
fix: aligner: fix initialize average distance label (#1192)
Browse files Browse the repository at this point in the history
* test: update expectation

Signed-off-by: Hiroshi Miura <[email protected]>

* fix: label initializer

Signed-off-by: Hiroshi Miura <[email protected]>

---------

Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr authored Nov 19, 2024
1 parent d59c0fd commit 65ac6c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions aligner/src/main/java/org/omegat/gui/align/AlignPanel.form
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@
</Component>
<Component class="javax.swing.JLabel" name="averageDistanceLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/omegat/gui/align/Bundle.properties" key="ALIGNER_PANEL_LABEL_AVGSCORE" replaceFormat="BUNDLE.getString(&quot;{key}&quot;)"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="StringUtil.format(BUNDLE.getString(&quot;ALIGNER_PANEL_LABEL_AVGSCORE&quot;), &quot;-&quot;)" type="code"/>
</Property>
</Properties>
<AuxValues>
Expand Down
3 changes: 2 additions & 1 deletion aligner/src/main/java/org/omegat/gui/align/AlignPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.omegat.gui.align.Aligner.CalculatorType;
import org.omegat.gui.align.Aligner.ComparisonMode;
import org.omegat.gui.align.Aligner.CounterType;
import org.omegat.util.StringUtil;

/**
* UI component for displaying and editing the results of algorithmic alignment.
Expand Down Expand Up @@ -204,7 +205,7 @@ private void initComponents() {
jPanel7.add(comparisonComboBox);
jPanel7.add(filler5);

averageDistanceLabel.setText(BUNDLE.getString("ALIGNER_PANEL_LABEL_AVGSCORE")); // NOI18N
averageDistanceLabel.setText(StringUtil.format(BUNDLE.getString("ALIGNER_PANEL_LABEL_AVGSCORE"), "-"));
jPanel7.add(averageDistanceLabel);
jPanel7.add(filler6);

Expand Down
13 changes: 6 additions & 7 deletions test-acceptance/src/org/omegat/gui/align/AlignerWindowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.File;
import java.util.List;
import java.util.Locale;
import java.util.regex.Pattern;

import org.assertj.swing.data.TableCell;
import org.assertj.swing.finder.WindowFinder;
Expand Down Expand Up @@ -81,12 +82,12 @@ public void testAligner() throws Exception {
//
aligner.panel("align_panel").label("align_panel_instructions_label")
.requireText("Step 1: Adjust alignment parameters");
aligner.panel("align_panel").label("align_panel_average_distance_label")
.requireText("Average Score: 1.011");
aligner.panel("align_panel").comboBox("align_panel_comparison_cb").requireSelection("Heapwise");
aligner.panel("align_panel").comboBox("align_panel_algorithm_cb").requireSelection("Viterbi");
aligner.panel("align_panel").comboBox("align_panel_calculator_cb").requireSelection("Normal");
//
aligner.panel("align_panel").table("align_panel_table").requireRowCount(5);
aligner.panel("align_panel").table("align_panel_table").requireColumnCount(3);
//
aligner.panel("align_panel").table("align_panel_table").requireCellValue(TableCell.row(0).column(0),
"true");
aligner.panel("align_panel").table("align_panel_table").requireCellValue(TableCell.row(0).column(1),
Expand All @@ -101,10 +102,8 @@ public void testAligner() throws Exception {
"And then this is a very, very, very long sentence.");
aligner.panel("align_panel").table("align_panel_table").requireCellValue(TableCell.row(2).column(2),
"Et puis c'est une phrase très, très, très longue.");
//
aligner.panel("align_panel").comboBox("align_panel_comparison_cb").requireSelection("Heapwise");
aligner.panel("align_panel").comboBox("align_panel_algorithm_cb").requireSelection("Viterbi");
aligner.panel("align_panel").comboBox("align_panel_calculator_cb").requireSelection("Normal");
aligner.panel("align_panel").label("align_panel_average_distance_label")
.requireText(Pattern.compile("Average Score:\\s(-|\\d\\.\\d{3})"));
//
aligner.button("align_panel_continue_button").click();
aligner.button("align_panel_save_button").requireEnabled();
Expand Down

0 comments on commit 65ac6c4

Please sign in to comment.