Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 41a9576f63b46dbc8ebf4398a4881b83da9b674a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright (c) 2013 QNX Software Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipse.cdt.qt.tests;

import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.QtIndex;

public class QtIndexTests extends BaseQtTestCase {

	private static final String Filename_testCache = "testCache.hh";

	// #include "junit-QObject.hh"
	// 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);

		QtIndex qtIndex = QtIndex.getIndex(fProject);
		assertNotNull(qtIndex);

		// make sure the instance can be found
		IQObject qobj1 = qtIndex.findQObject(new String[]{ "B" });
		assertNotNull(qobj1);
		assertEquals("B", qobj1.getName());

		// make sure the instance is still found after the content changes
		changeBDecl();
		IQObject qobj2 = qtIndex.findQObject(new String[]{ "B" });
		assertNotNull(qobj2);
		assertEquals("B", qobj2.getName());
	}
}

Back to the top