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. _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice