Sort / format / checkstyle fixes.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5003 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/i18n/client/DateTimeFormat.java b/user/src/com/google/gwt/i18n/client/DateTimeFormat.java
index 65f0380..31dd9aa 100644
--- a/user/src/com/google/gwt/i18n/client/DateTimeFormat.java
+++ b/user/src/com/google/gwt/i18n/client/DateTimeFormat.java
@@ -434,10 +434,6 @@
return new DateTimeFormat(pattern, getDefaultDateTimeConstants());
}
- private static DateTimeConstants getDefaultDateTimeConstants() {
- return LocaleInfo.getCurrentLocale().getDateTimeConstants();
- }
-
/**
* Retrieve the DateTimeFormat object for full date format. The pattern for
* this format is predefined for each locale.
@@ -610,6 +606,10 @@
return cachedShortTimeFormat;
}
+ private static DateTimeConstants getDefaultDateTimeConstants() {
+ return LocaleInfo.getCurrentLocale().getDateTimeConstants();
+ }
+
private final ArrayList<PatternPart> patternParts = new ArrayList<PatternPart>();
private final DateTimeConstants dateTimeConstants;
diff --git a/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTest.java b/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTest.java
index 524a335..492d055 100644
--- a/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTest.java
@@ -20,7 +20,7 @@
import com.google.gwt.user.client.rpc.CustomFieldSerializerTestSetFactory.SerializableSubclass;
/**
- * Tests the following scenarios:
+ * Tests the following scenarios.
* <ul>
* <li>Manually serializable types use their custom field serializer</li>
* <li>Subtypes of manually serializable types that are not auto-serializable
@@ -40,7 +40,7 @@
/**
* Test that custom field serializers do not make their subclasses
- * serializable
+ * serializable.
*/
public void testCustomFieldSerializabilityInheritance() {
delayTestFinish(TEST_DELAY);
@@ -60,7 +60,7 @@
}
/**
- * Tests that the custom field serializers are actually called
+ * Tests that the custom field serializers are actually called.
*/
public void testCustomFieldSerialization() {
delayTestFinish(TEST_DELAY);
@@ -82,8 +82,31 @@
}
/**
+ * Test that custom serializers that call readObject() inside instantiate (as
+ * is required for most immutable classes) work.
+ */
+ public void testSerializableImmutables() {
+ delayTestFinish(TEST_DELAY);
+
+ CustomFieldSerializerTestServiceAsync service = getServiceAsync();
+ service.echo(
+ CustomFieldSerializerTestSetFactory.createSerializableImmutablesArray(),
+ new AsyncCallback() {
+ public void onFailure(Throwable caught) {
+ fail("Could not serialize/deserialize immutable classes: " + caught);
+ }
+
+ public void onSuccess(Object result) {
+ assertNotNull(result);
+ assertTrue(CustomFieldSerializerTestSetValidator.isValid((ManuallySerializedImmutableClass[]) result));
+ finishTest();
+ }
+ });
+ }
+
+ /**
* Test that serializable subclasses of classes that have custom field
- * serializers serialize and deserialize correctly
+ * serializers serialize and deserialize correctly.
*/
public void testSerializableSubclasses() {
delayTestFinish(TEST_DELAY);
@@ -104,31 +127,6 @@
});
}
- /**
- * Test that custom serializers that call readObject() inside instantiate
- * (as is required for most immutable classes) work.
- */
- public void testSerializableImmutables() {
- delayTestFinish(TEST_DELAY);
-
- CustomFieldSerializerTestServiceAsync service = getServiceAsync();
- service.echo(
- CustomFieldSerializerTestSetFactory.createSerializableImmutablesArray(),
- new AsyncCallback() {
- public void onFailure(Throwable caught) {
- fail("Could not serialize/deserialize immutable classes: " +
- caught);
- }
-
- public void onSuccess(Object result) {
- assertNotNull(result);
- assertTrue(CustomFieldSerializerTestSetValidator.isValid(
- (ManuallySerializedImmutableClass[]) result));
- finishTest();
- }
- });
- }
-
private CustomFieldSerializerTestServiceAsync getServiceAsync() {
if (customFieldSerializerTestService == null) {
customFieldSerializerTestService = (CustomFieldSerializerTestServiceAsync) GWT.create(CustomFieldSerializerTestService.class);
diff --git a/user/test/com/google/gwt/user/client/ui/RadioButtonTest.java b/user/test/com/google/gwt/user/client/ui/RadioButtonTest.java
index c223773..92c6054 100644
--- a/user/test/com/google/gwt/user/client/ui/RadioButtonTest.java
+++ b/user/test/com/google/gwt/user/client/ui/RadioButtonTest.java
@@ -38,6 +38,79 @@
}
}
+ /**
+ * TODO: Re-enable when we figure out how to make them work properly on IE
+ * (which has the unfortunate property of not passing synthesized events on to
+ * native controls, keeping the clicks created by these tests from actually
+ * affecting the radio buttons' states).
+ */
+ public void disabledTestValueChangeViaClick() {
+ RadioButton r1 = new RadioButton("group1", "Radio 1");
+ RadioButton r2 = new RadioButton("group1", "Radio 2");
+ RootPanel.get().add(r1);
+ RootPanel.get().add(r2);
+ r1.setValue(true);
+
+ Changeable c1 = new Changeable();
+ r1.addValueChangeHandler(c1);
+
+ Changeable c2 = new Changeable();
+ r2.addValueChangeHandler(c2);
+
+ // Brittle, but there's no public access
+ InputElement r1Radio = getRadioElement(r1);
+ InputElement r2Radio = getRadioElement(r2);
+
+ doClick(r1Radio);
+ assertEquals(null, c1.received);
+ assertEquals(null, c2.received);
+
+ doClick(r2Radio);
+ assertEquals(null, c1.received);
+ assertEquals(Boolean.TRUE, c2.received);
+ c2.received = null;
+
+ doClick(r1Radio);
+ assertEquals(Boolean.TRUE, c1.received);
+ assertEquals(null, c2.received);
+ }
+
+ /**
+ * TODO: Re-enable when we figure out how to make them work properly on IE
+ * (which has the unfortunate property of not passing synthesized events on to
+ * native controls, keeping the clicks created by these tests from actually
+ * affecting the radio buttons' states).
+ */
+ public void disabledTestValueChangeViaLabelClick() {
+ RadioButton r1 = new RadioButton("group1", "Radio 1");
+ RadioButton r2 = new RadioButton("group1", "Radio 2");
+ RootPanel.get().add(r1);
+ RootPanel.get().add(r2);
+ r1.setValue(true);
+
+ Changeable c1 = new Changeable();
+ r1.addValueChangeHandler(c1);
+
+ Changeable c2 = new Changeable();
+ r2.addValueChangeHandler(c2);
+
+ LabelElement r1Label = getLabelElement(r1);
+ LabelElement r2Label = getLabelElement(r2);
+
+ doClick(r1Label);
+ assertEquals(null, c1.received);
+ assertEquals(null, c2.received);
+
+ doClick(r2Label);
+ assertEquals(null, c1.received);
+ assertEquals(Boolean.TRUE, c2.received);
+ c2.received = null;
+
+ doClick(r1Label);
+ assertEquals(Boolean.TRUE, c1.received);
+ assertEquals(null, c2.received);
+ }
+
@Override
public String getModuleName() {
return "com.google.gwt.user.DebugTest";
@@ -126,8 +199,8 @@
}
/**
- * Ensures that the element order doesn't get reversed when the radio's
- * name is changed.
+ * Ensures that the element order doesn't get reversed when the radio's name
+ * is changed.
*/
public void testOrderAfterSetName() {
RadioButton radio = new RadioButton("oldName");
@@ -143,94 +216,28 @@
assertEquals("label", secondChild.getTagName().toLowerCase());
}
-// TODO: Re-enable these tests when we figure out how to make them work
-// properly on IE (which has the unfortunate property of not passing
-// synthesized events on to native controls, keeping the clicks created by
-// these tests from actually affecting the radio buttons' states).
-//
-// public void testValueChangeViaClick() {
-// RadioButton r1 = new RadioButton("group1", "Radio 1");
-// RadioButton r2 = new RadioButton("group1", "Radio 2");
-// RootPanel.get().add(r1);
-// RootPanel.get().add(r2);
-// r1.setValue(true);
-//
-// Changeable c1 = new Changeable();
-// r1.addValueChangeHandler(c1);
-//
-// Changeable c2 = new Changeable();
-// r2.addValueChangeHandler(c2);
-//
-// // Brittle, but there's no public access
-// InputElement r1Radio = getRadioElement(r1);
-// InputElement r2Radio = getRadioElement(r2);
-//
-// doClick(r1Radio);
-// assertEquals(null, c1.received);
-// assertEquals(null, c2.received);
-//
-// doClick(r2Radio);
-// assertEquals(null, c1.received);
-// assertEquals(Boolean.TRUE, c2.received);
-// c2.received = null;
-//
-// doClick(r1Radio);
-// assertEquals(Boolean.TRUE, c1.received);
-// assertEquals(null, c2.received);
-// }
-//
-// public void testValueChangeViaLabelClick() {
-// RadioButton r1 = new RadioButton("group1", "Radio 1");
-// RadioButton r2 = new RadioButton("group1", "Radio 2");
-// RootPanel.get().add(r1);
-// RootPanel.get().add(r2);
-// r1.setValue(true);
-//
-// Changeable c1 = new Changeable();
-// r1.addValueChangeHandler(c1);
-//
-// Changeable c2 = new Changeable();
-// r2.addValueChangeHandler(c2);
-//
-// LabelElement r1Label = getLabelElement(r1);
-// LabelElement r2Label = getLabelElement(r2);
-//
-// doClick(r1Label);
-// assertEquals(null, c1.received);
-// assertEquals(null, c2.received);
-//
-// doClick(r2Label);
-// assertEquals(null, c1.received);
-// assertEquals(Boolean.TRUE, c2.received);
-// c2.received = null;
-//
-// doClick(r1Label);
-// assertEquals(Boolean.TRUE, c1.received);
-// assertEquals(null, c2.received);
-// }
-//
-// private void doClick(Element elm) {
-// NativeEvent e = Document.get().createMouseDownEvent(0, 25, 25, 25, 25,
-// false, false, false, false, NativeEvent.BUTTON_LEFT);
-// elm.dispatchEvent(e);
-//
-// e = Document.get().createMouseUpEvent(0, 25, 25, 25, 25, false, false,
-// false, false, NativeEvent.BUTTON_LEFT);
-// elm.dispatchEvent(e);
-//
-// e = Document.get().createClickEvent(0, 25, 25, 25, 25, false, false, false,
-// false);
-// elm.dispatchEvent(e);
-// }
-//
-// private LabelElement getLabelElement(RadioButton radioButton) {
-// LabelElement r1Label = LabelElement.as(Element.as(getRadioElement(
-// radioButton).getNextSiblingElement()));
-// return r1Label;
-// }
-//
-// private InputElement getRadioElement(RadioButton radioButton) {
-// InputElement r1Radio = InputElement.as(Element.as(radioButton.getElement().getFirstChild()));
-// return r1Radio;
-// }
+ private void doClick(Element elm) {
+ NativeEvent e = Document.get().createMouseDownEvent(0, 25, 25, 25, 25,
+ false, false, false, false, NativeEvent.BUTTON_LEFT);
+ elm.dispatchEvent(e);
+
+ e = Document.get().createMouseUpEvent(0, 25, 25, 25, 25, false, false,
+ false, false, NativeEvent.BUTTON_LEFT);
+ elm.dispatchEvent(e);
+
+ e = Document.get().createClickEvent(0, 25, 25, 25, 25, false, false, false,
+ false);
+ elm.dispatchEvent(e);
+ }
+
+ private LabelElement getLabelElement(RadioButton radioButton) {
+ LabelElement r1Label = LabelElement.as(Element.as(getRadioElement(
+ radioButton).getNextSiblingElement()));
+ return r1Label;
+ }
+
+ private InputElement getRadioElement(RadioButton radioButton) {
+ InputElement r1Radio = InputElement.as(Element.as(radioButton.getElement().getFirstChild()));
+ return r1Radio;
+ }
}