Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/qt
diff options
context:
space:
mode:
Diffstat (limited to 'qt')
-rw-r--r--qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java32
-rw-r--r--qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java1
-rw-r--r--qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java20
3 files changed, 38 insertions, 15 deletions
diff --git a/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java b/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
index fd7210bf17..1eff209069 100644
--- a/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
+++ b/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/BaseQtTestCase.java
@@ -7,6 +7,7 @@
*/
package org.eclipse.cdt.qt.tests;
+import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.index.IIndex;
@@ -18,6 +19,11 @@ import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
import org.eclipse.cdt.qt.core.QtNature;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
public class BaseQtTestCase extends BaseTestCase {
@@ -39,15 +45,31 @@ public class BaseQtTestCase extends BaseTestCase {
protected ICProject fCProject;
protected IIndex fIndex;
+ public static ICProject createQtProject(final String projectName, final String binFolderName) throws CoreException {
+ final IWorkspace ws = ResourcesPlugin.getWorkspace();
+ final ICProject newProject[] = new ICProject[1];
+ ws.run(new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ICProject cproject = CProjectHelper.createCProject(projectName, binFolderName, IPDOMManager.ID_FAST_INDEXER);
+ if (!cproject.getProject().hasNature(CCProjectNature.CC_NATURE_ID)) {
+ CProjectHelper.addNatureToProject(cproject.getProject(), CCProjectNature.CC_NATURE_ID, null);
+ QtNature.addNature(cproject.getProject(), new NullProgressMonitor());
+ }
+ newProject[0] = cproject;
+ }
+ }, null);
+ return newProject[0];
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();
String projectName = "__" + getClass().getSimpleName() + "__";
- fCProject = CProjectHelper.createCCProject(projectName, "bin", IPDOMManager.ID_FAST_INDEXER);
+ fCProject = createQtProject(projectName, "bin");
fProject = fCProject.getProject();
- QtNature.addNature(fProject, new NullProgressMonitor());
fIndex = CCorePlugin.getIndexManager().getIndex(fCProject);
indexQObject_h();
@@ -150,15 +172,17 @@ public class BaseQtTestCase extends BaseTestCase {
// add the new content
fFile = TestSourceReader.createFile(fProject, filename, contents[0]);
+ CCorePlugin.getIndexManager().reindex(fCProject);// just make sure we re-indexing here
// wait for the index to change
Thread.yield();
+ waitForIndexer(fCProject);
for(long stopAt = System.currentTimeMillis() + 3000;
System.currentTimeMillis() < stopAt && timestamp == indexManager.getIndex(fCProject).getLastWriteAccess();
Thread.sleep(100)) {
- /* intentionally empty*/
+ waitForIndexer(fCProject);
}
-
assertNotSame(timestamp, indexManager.getIndex(fCProject).getLastWriteAccess());
+
}
/**
diff --git a/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java b/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java
index f75212ff78..bd39de5511 100644
--- a/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java
+++ b/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QmlRegistrationTests.java
@@ -100,7 +100,6 @@ public class QmlRegistrationTests extends BaseQtTestCase {
// }
public void testQmlRegisterFwdDecl() throws Exception {
loadComment("qmlregistertype.hh");
- waitForIndexer(fCProject);
QtIndex qtIndex = QtIndex.getIndex(fProject);
assertNotNull(qtIndex);
diff --git a/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java b/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java
index e4fd185258..41a9576f63 100644
--- a/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java
+++ b/qt/org.eclipse.cdt.qt.tests/src/org/eclipse/cdt/qt/tests/QtIndexTests.java
@@ -18,6 +18,16 @@ public class QtIndexTests extends BaseQtTestCase {
// class B : public QObject
// {
// Q_OBJECT
+ // Q_PROPERTY(bool allowed READ isAllowed)
+ // };
+ public void changeBDecl() throws Exception {
+ loadComment(Filename_testCache);
+ }
+
+ // #include "junit-QObject.hh"
+ // class B : public QObject
+ // {
+ // Q_OBJECT
// };
public void testLookup() throws Exception {
loadComment(Filename_testCache);
@@ -36,14 +46,4 @@ public class QtIndexTests extends BaseQtTestCase {
assertNotNull(qobj2);
assertEquals("B", qobj2.getName());
}
-
- // #include "junit-QObject.hh"
- // class B : public QObject
- // {
- // Q_OBJECT
- // Q_PROPERTY(bool allowed READ isAllowed())
- // };
- public void changeBDecl() throws Exception {
- loadComment(Filename_testCache);
- }
}

Back to the top