@Test
public void testPrefSizeEmptyInsertText() {

    JXDatePicker picker = new JXDatePicker();
    Dimension empty = picker.getPreferredSize();
    // simulate editing (uncommitted)
    picker.getEditor().setText("1");
    assertEquals("pref width must be same while editing", 
            empty.width, picker.getPreferredSize().width);
}