DocumentController::openDocument(KUrl) fails in QtTest

Martin Heide Martin.Heide at gmx.net
Wed Feb 16 16:29:06 UTC 2011


Hi,

I could need some help for QtTests concerning the DocumentController:

I'm trying to write a test for a feature that I implemented. The test should open several files and verify the position of the Sublime::Views that are created.

My problem is, when I call 
Core::self()->documentController()->openDocument(KUrl("/path/file.cpp"));
in my test function, I get 


QDEBUG : ShellBuddyTest::testDeclarationDefinitionOrder() qttest(23628)/kdevplatform (language) KDevelop::BackgroundParser::documentLoaded: Creating change tracker for  KUrl("file:///home/martin/tmp/a.cpp")
QFATAL : ShellBuddyTest::testDeclarationDefinitionOrder() ASSERT: "KDevelop::ForegroundLock::isLockedForThread()" in file /home/martin/d/src/kdevplatform/language/backgroundparser/documentchangetracker.cpp, line 108
FAIL!  : ShellBuddyTest::testDeclarationDefinitionOrder() Received a fatal error.
   Loc: [Unknown file(0)]


and the test fails. This happens as well with an already-existing file, as well if I create the file on-the-fly in the test (KTempDir, create a QFile inside).

Is there someone who can tell me how to properly open documents inside QtTests? If I use
Core::self()->documentController()->openDocumentFromText("Test1");
instead (like it is done in kdevplatform/shell/tests/shelldocumentoperationtest.cpp), i get no error. So the problem must be related somehow with the access to the filesystem, I think.
The assert that fails is in void DocumentChangeTracker::reset().

I verified that opening documents by the user in the Kdevelop GUI works well, it fails only in the QtTest.


Thanks for your help!
Regards, Martin




-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de




More information about the KDevelop-devel mailing list