On 21.05.2016 15:55, jan iversen wrote:
Hi
Calling for the help of core developers, I recieved this email in private. I am not sure what the
correct answer is, so please give me a hand.
Hey Jan,
I'm trying to test a private method for Writer in hopes of increasing coverage a little. The
Readme says that sw/qa/core/uiwritter.cxx has access to private symbols, but I can't seem to get
my test working. I keep getting this typical CPP error message when compiling:
/home/adam/libreoffice-source/core/sw/qa/core/uwriter.cxx: In member function ‘void
SwDocTest::testTableCellComparison()’:
/home/adam/libreoffice-source/core/sw/qa/core/uwriter.cxx:1634:82: error:
‘sw_CompareCellsByRowFirst’ was not declared in this scope
CPPUNIT_ASSERT_EQUAL(sw_CompareCellsByRowFirst(OUString("A1"), OUString("Z1")), 0);
Should I not be testing private methods? Or am I doing something wrong here? Am I not importing
the right files?
Every test is POSITIVE, so yes in my opinion you should.
You need to declare the test class "friend" of the implementing class, that would solve the
problem, however I am unsure how we do this in general, so please read answers from others.
"sw_CompareCellsByRowFirst" is a top-level function in unotbl.cxx, there
is no header that contains a declaration. since it does not have
"static" linkage and isn't in an anonymous namespace you should be able
to call it if you add a forward declaration of it in uwriter.cxx.
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.