Fix the alignment for non-ASCII strings
authorThiago Macieira <thiago.macieira@intel.com>
Fri, 17 Jan 2014 04:37:16 +0000 (20:37 -0800)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 21 Jan 2014 23:04:16 +0000 (00:04 +0100)
commit2d8028d696a86102a7753f9d59fb41f4170181a8
tree761a4c67e915fd49d4c342cdaba2772f1097413c
parent57d36d3f0cbbf641bb67f7f183edcb52aa15180d
Fix the alignment for non-ASCII strings

d040681b6f3d03b349e9b9487fe89a611d03ee3c added support for aligning the
test results for easier side-by-side comparison of the actual and
expected values. However, it didn't take into account multibyte strings.
That is, we would see:

FAIL!  tst_testcase::testcase: Compared values are not the same
   Actual   (QString("é")): F0O
   Expected (expected)     : FOO

We use mbstowcs (multibyte string to wide char string) that calculates
the length in wide chars of the output string. That's roughly equivalent
to QString::fromLocal8Bit(string).toUcs4().size().

Change-Id: Ic2649951c50e05143da32a7fbef00a01e385c542
Reviewed-by: Jason McDonald <macadder1@gmail.com>
src/testlib/qtestresult.cpp