qmltestrunner reports wrong LOC for failed test cases
authorCharles Yin <charles.yin@nokia.com>
Fri, 25 Nov 2011 01:41:04 +0000 (11:41 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 28 Nov 2011 00:20:45 +0000 (01:20 +0100)
The callerFile() and callerLine() calls GetFrame() with incorrect index,
the right index should be the current frame index + 1.

Task-number:QTBUG-22887
Change-Id: I694073b80853bf66e02414a158c8e155f8be8390
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
src/imports/testlib/main.cpp

index c78a1c4..c7d7d91 100644 (file)
@@ -108,8 +108,8 @@ public Q_SLOTS:
     {
         v8::Local<v8::StackTrace> stacks = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
         int count = stacks->GetFrameCount();
-        if (count >= frameIndex + 2) {
-            v8::Local<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 2);
+        if (count >= frameIndex + 1) {
+            v8::Local<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 1);
             return QDeclarativeV8Handle::fromHandle(frame->GetScriptNameOrSourceURL());
         }
         return QDeclarativeV8Handle();
@@ -118,8 +118,8 @@ public Q_SLOTS:
     {
         v8::Local<v8::StackTrace> stacks = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
         int count = stacks->GetFrameCount();
-        if (count >= frameIndex + 2) {
-            v8::Local<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 2);
+        if (count >= frameIndex + 1) {
+            v8::Local<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 1);
             return frame->GetLineNumber();
         }
         return -1;