@Test
public void testPrefSizeValueInsertText() {

    // initial size with value
    JXDatePicker picker = new JXDatePicker(new Date());
    Dimension withValue = picker.getPreferredSize();
    // simulate editing (uncommitted)
    picker.getEditor().setText("1");
    assertEquals("pref width must be same while editing", 
            withValue.width, picker.getPreferredSize().width);
}