DocumentController::openDocument(KUrl) fails in QtTest

Milian Wolff mail at milianw.de
Wed Feb 16 17:30:32 UTC 2011


On 02/16/11 17:29, Martin Heide wrote:
> 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.

What version of KDevelop is that - most recent git master? David changed 
a few things in the way the Foreground lock is initially acquired, so it 
might be related. But first make sure you are actually up to date.

bye

-- 
Milian Wolff
http://milianw.de




More information about the KDevelop-devel mailing list