Author: dmaliarevich
Date: 2011-01-31 09:26:24 -0500 (Mon, 31 Jan 2011)
New Revision: 28762
Modified:
branches/jbosstools-3.2.x/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java
Log:
https://issues.jboss.org/browse/JBIDE-8152 , fixed in branch.
Modified:
branches/jbosstools-3.2.x/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java
===================================================================
---
branches/jbosstools-3.2.x/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java 2011-01-31
14:26:07 UTC (rev 28761)
+++
branches/jbosstools-3.2.x/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java 2011-01-31
14:26:24 UTC (rev 28762)
@@ -19,12 +19,16 @@
import java.util.ResourceBundle;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.FindReplaceDocumentAdapter;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.base.test.TestUtil;
import org.jboss.tools.vpe.base.test.VpeTest;
@@ -260,12 +264,24 @@
* Change the locale
*/
Element fViewElement =
controller.getSourceBuilder().getSourceDocument().getElementById(FVIEW_ID);
+ int offset = controller.getSourceBuilder().getPosition(fViewElement,0,false);
assertTrue("Previous locale should be 'de'",
"de".equalsIgnoreCase(fViewElement.getAttribute("locale")));
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- fViewElement.setAttribute("locale", "en_GB"); //$NON-NLS-1$
//$NON-NLS-2$
+
+ IRegion reg = new FindReplaceDocumentAdapter(
+ controller.getSourceBuilder().getStructuredTextViewer().getDocument())
+ .find(offset, "de", true, true, false, false);
+ controller.getSourceBuilder().getStructuredTextViewer().getDocument().replace(reg.getOffset(),
reg.getLength(), "en_GB");
/*
* Wait until new value is applied and children are refreshed.
+ * Wait while all deferred events are processed
*/
+ while(Display.getCurrent().readAndDispatch());
+ /*
+ * Wait while all jobs including started through deferred events are ended
+ */
+ JobUtils.delay(VpeController.DEFAULT_UPDATE_DELAY_TIME*4);
TestUtil.waitForIdle();
+ fViewElement =
controller.getSourceBuilder().getSourceDocument().getElementById(FVIEW_ID);
assertTrue("Current locale should be 'en_GB'",
"en_GB".equalsIgnoreCase(fViewElement.getAttribute("locale")));
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
doc = controller.getXulRunnerEditor().getDOMDocument();
localeText = doc.getElementById(LOCALE_TEXT_ID);