--- /dev/null
+package com.vaadin.tests.components.textfield;
+
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.TextField;
+
+import java.math.BigDecimal;
+import java.util.Locale;
+
+public class LocaleChangeOnReadOnlyField extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final TextField textField = getReadOnlyTextField();
+ addComponent(textField);
+
+ Button changeLocaleButton = addLocaleChangeButton(textField);
+ addComponent(changeLocaleButton);
+ }
+
+ private TextField getReadOnlyTextField() {
+ final TextField textField = new TextField();
+
+ textField.setConverter(BigDecimal.class);
+ textField.setLocale(Locale.US);
+ textField.setValue("1024000");
+ textField.setReadOnly(true);
+
+ return textField;
+ }
+
+ private Button addLocaleChangeButton(final TextField textField) {
+ Button changeLocaleButton = new Button();
+ changeLocaleButton.setCaption("Change Locale");
+ changeLocaleButton.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ textField.setLocale(Locale.GERMANY);
+ }
+ });
+
+ return changeLocaleButton;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Read-only fields throw exception when setting converted value in localeMightHaveChanged()";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14400;
+ }
+}
--- /dev/null
+package com.vaadin.tests.components.textfield;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TextFieldElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+public class LocaleChangeOnReadOnlyFieldTest extends MultiBrowserTest {
+
+ @Test
+ public void localeIsChangedOnReadOnlyField() {
+ openTestURL();
+
+ TextFieldElement textField = $(TextFieldElement.class).first();
+ assertThat(textField.getValue(), is("1,024,000"));
+
+ $(ButtonElement.class).caption("Change Locale").first().click();
+ assertThat(textField.getValue(), is("1.024.000"));
+ }
+
+}
\ No newline at end of file