More and Better Tests GSOC weekly update
Hello, This week I finished working on three new tests. The test for tdf#122452 which can be found here https://gerrit.libreoffice.org/c/core/+/171126 The test for tdf#135709 which can be found here https://gerrit.libreoffice.org/c/core/+/171222 And the test for tdf#135710 which can be found here https://gerrit.libreoffice.org/c/core/+/171467 During the week I have also taken the time to update my remaining schedule, as well as look through the Missing Unit test list to find some more candidates to write tests for. As I have started to succeed in writing a few more tests, it has become easier to recognize which bug reports will present fewer issues in writing a test. With this in mind I have come up with a better defined list of tests to work on in the coming weeks. I'm currently working on writing a test for: tdf#131288 and have successfully recreated the bug for tdf#134973 After those two test, my list has the following bug reports on it tdf#120629 tdf#138625 tdf#137643 tdf#116301 tdf#129475 Have a good week, Adam Seskunas
core.git: sw/qa
sw/qa/extras/ww8export/ww8export4.cxx | 27 +++ 1 file changed, 27 insertions(+) New commits: commit f8eac9eaf0b513460341ef158b610865d68fd536 Author: Adam Seskunas AuthorDate: Sun Aug 4 12:58:26 2024 -0700 Commit: Hossein CommitDate: Tue Aug 6 15:18:55 2024 +0200 tdf#135710 - Add Unit test Change-Id: I17189845ba273f1843a922e5b8aa521a8580dcb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171467 Reviewed-by: Hossein Tested-by: Jenkins diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index d72121affb87..798e3e52da75 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -413,6 +413,33 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf135709) xPropertySet->getPropertyValue("Surround") >>= eValue; CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrap should be PARALLEL", text::WrapTextMode_PARALLEL, eValue); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf135710) +{ +// Uses same test doc as testTdf135709 +createSwDoc("tdf135709.odt"); +saveAndReload("MS Word 97"); + +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + +sal_Int32 nFlyLeft = getXPath(pXmlDoc, "(//anchored)[1]/fly/infos/bounds"_ostr, "left"_ostr).toInt32(); + +// Set the anchor of the image to AT PARAGRAPH, without the fix in place this +// results in the picture moving to the first column +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xPropertySet(xTextFramesSupplier->getTextFrames()->getByName("Frame1") , uno::UNO_QUERY); +xPropertySet->setPropertyValue("AnchorType", + uno::Any(text::TextContentAnchorType_AT_PARAGRAPH)); +pXmlDoc = parseLayoutDump(); + +sal_Int32 nFlyLeftAfter = getXPath(pXmlDoc, "(//anchored)[1]/fly/infos/bounds"_ostr, "left"_ostr).toInt32(); + +// Without the fix in place this fails with +// Expected: 4771 +// Actual: 1418 +// i.e. the picture has moved from the second column to the first column +CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast(nFlyLeft), static_cast(nFlyLeftAfter), 2.0); +} } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
core.git: sw/CppunitTest_sw_odfexport2.mk sw/qa
sw/CppunitTest_sw_odfexport2.mk |1 + sw/qa/extras/odfexport/data/tdf122452.doc |binary sw/qa/extras/odfexport/odfexport2.cxx | 16 3 files changed, 17 insertions(+) New commits: commit 11fa654dab2b7e35d724c804e1a11a1d72dde88e Author: Adam Seskunas AuthorDate: Sat Jul 27 12:56:28 2024 -0700 Commit: Hossein CommitDate: Tue Aug 6 13:23:52 2024 +0200 tdf#122452 - Add Unit Test Change-Id: Ifce16dd9ec093c515e61f65b58e0414b1a157a5e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171126 Reviewed-by: Hossein Tested-by: Jenkins diff --git a/sw/CppunitTest_sw_odfexport2.mk b/sw/CppunitTest_sw_odfexport2.mk index 43a35b404559..9d5dc86145a4 100644 --- a/sw/CppunitTest_sw_odfexport2.mk +++ b/sw/CppunitTest_sw_odfexport2.mk @@ -44,6 +44,7 @@ $(eval $(call gb_CppunitTest_set_include,sw_odfexport2,\ -I$(SRCDIR)/sw/inc \ -I$(SRCDIR)/sw/source/core/inc \ -I$(SRCDIR)/sw/qa/inc \ +-I$(SRCDIR)/sw/source/uibase/inc \ $$(INCLUDE) \ )) diff --git a/sw/qa/extras/odfexport/data/tdf122452.doc b/sw/qa/extras/odfexport/data/tdf122452.doc new file mode 100644 index ..9fd823130d38 Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf122452.doc differ diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index debea006f068..f9205f752054 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include #include @@ -1714,6 +1716,20 @@ CPPUNIT_TEST_FIXTURE(Test, testMidnightRedlineDatetime) u"2001-01-01T00:00:00"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testTdf122452) +{ +// FIXME: Error: element "text:insertion" was found where no element may occur +skipValidation(); +loadAndReload("tdf122452.doc"); +SwDoc* pDoc = getSwDoc(); +SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + +// Without the fix in place this fails with: +// Expected: 1 +// Actual: 0 +CPPUNIT_ASSERT_EQUAL_MESSAGE("Redlines should be Hidden", true, pWrtShell->GetLayout()->IsHideRedlines()); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
core.git: sw/qa
sw/qa/extras/ww8export/data/tdf135709.odt |binary sw/qa/extras/ww8export/ww8export4.cxx | 16 2 files changed, 16 insertions(+) New commits: commit b53c654552e2bec837ea996c60ab929e0398640d Author: Adam Seskunas AuthorDate: Mon Jul 29 15:56:00 2024 -0700 Commit: Xisco Fauli CommitDate: Wed Jul 31 13:16:09 2024 +0200 tdf#135709 - Add Unit Test Change-Id: I35b2d894ce1dbffed013983585bc8cc14b93b59f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171222 Reviewed-by: Xisco Fauli Tested-by: Jenkins diff --git a/sw/qa/extras/ww8export/data/tdf135709.odt b/sw/qa/extras/ww8export/data/tdf135709.odt new file mode 100644 index ..eb636be21260 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf135709.odt differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 60fa17634441..d72121affb87 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -397,6 +398,21 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyGroup) saveAndReload(mpFilter); } +CPPUNIT_TEST_FIXTURE(Test, testTdf135709) +{ +createSwDoc("tdf135709.odt"); +saveAndReload("MS Word 97"); + +uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xPropertySet(xTextFramesSupplier->getTextFrames()->getByName("Frame1") , uno::UNO_QUERY); + +xPropertySet->setPropertyValue("AnchorType", + uno::Any(text::TextContentAnchorType_AT_CHARACTER)); + +text::WrapTextMode eValue; +xPropertySet->getPropertyValue("Surround") >>= eValue; +CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrap should be PARALLEL", text::WrapTextMode_PARALLEL, eValue); +} } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
GSOC More and Better Tests: Weekly Update
Hello, This week things have been moving along much smoother, no issues at all stemming from my OS or my LO builds. I've submitted a test for tdf#122452 which can be found here https://gerrit.libreoffice.org/c/core/+/171126 The patch is currently failing CI, this is to highlight an issue I was having with detecting whether the redlining in the document was visible or not. The issue should be easy enough to work out, and hopefully the patch can be merged in the near future. Next up, I've written a test for tdf#135710 which can be found here https://gerrit.libreoffice.org/c/core/+/171222 This one is good to go, the test works for me and is passing CI, just needs to finish code review. After having some trouble trying to reproduce the bug in tdf#135709 with my old working environment, I was finally able to build on the correct commit and reproduce the undesired behavior associated with the bug. Since this is a close cousin of tdf#135710, they share the same input document, I thought writing the test would be trivial. Unfortunately I've run into some problems detecting the movement of the offending image in the .doc file. I should have a patch by next week. I've also spent some time testing https://gerrit.libreoffice.org/c/core/+/170864 trying to resolve an issue with setting SvtSecurtiyOptions::DocWarnKeepDocVersionInfo. Next up are tests for the following bug reports: https://bugs.documentfoundation.org/show_bug.cgi?id=134973 https://bugs.documentfoundation.org/show_bug.cgi?id=131288 https://bugs.documentfoundation.org/show_bug.cgi?id=129475 That's all for now, have a good week, Adam Seskunas
GSOC More and Better tests update
Hello, Over the past few weeks I’ve run into many issues with my LO builds. Each time having to run make clean, or try building a brand new repo. And last week, as mentioned before, I was having such severe problems that I created a new user account on my Operating System, in order to get everything working again, after which, I quickly ran into problems again. This has resulted in quite a bit of frustration on my part, and painfully slow progress toward my goal of writing as many tests as possible. And so after discussing this with my mentors, Xisco and Hossein recommended that I switch my OS from Fedora over to Ubuntu. This ended up being a time consuming process, it took a whole day to get everything working again, and then some time to set up my working environment, but in the end paid off and things are going much smoother now. Using Ubuntu I’ve been able to easily build off commits that were giving me loads of problems before with Fedora. So if anyone is reading this and pondering which Linux distro to choose for development work, go with the safe choice, Ubuntu. So after loosing some time for infrastructure work, I’ve been able to get the ball rolling. I’ve written most of the test for tdf#157484, the patch is for which is here https://gerrit.libreoffice.org/c/core/+/170864 <https://gerrit.libreoffice.org/c/core/+/170864> I’ve also written a test for this bug report https://bugs.documentfoundation.org/show_bug.cgi?id=122452 <https://bugs.documentfoundation.org/show_bug.cgi?id=122452> It is currently not working as expected and needs some debugging. In addition to working on these two tests I’ve been trying to reproduce other bugs and while I’ve been able to build on the appropriate commits, I’ve not been able to reproduce the bugs. And so I’ve started going through the list of Missing Unit tests in order to find good candidates for tests. Next on the list I have https://bugs.documentfoundation.org/show_bug.cgi?id=135709 <https://bugs.documentfoundation.org/show_bug.cgi?id=135709> https://bugs.documentfoundation.org/show_bug.cgi?id=134973 <https://bugs.documentfoundation.org/show_bug.cgi?id=134973> https://bugs.documentfoundation.org/show_bug.cgi?id=131288 <https://bugs.documentfoundation.org/show_bug.cgi?id=131288> The bugs here are verified on Linux, relatively recent fixes and have clearly defined steps to reproduce, which will aid in writing the tests. Until next week, Adam Seskunas
core.git: sw/qa
sw/qa/filter/ww8/data/tdf71749_with_footnote.doc|binary sw/qa/filter/ww8/data/tdf71749_without_footnote.doc |binary sw/qa/filter/ww8/ww8.cxx| 16 3 files changed, 16 insertions(+) New commits: commit d5d4e1334957abc29c5c4f543a8cd15a5aaf8748 Author: Adam Seskunas AuthorDate: Mon Jul 8 11:23:10 2024 -0700 Commit: Xisco Fauli CommitDate: Thu Jul 18 01:11:12 2024 +0200 tdf#71749 Unit test for sw: WW8: don't loop on tables in footnotes Change-Id: I5ca830b2ec0c883a23bab1ece006f8c88310f3ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170169 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/filter/ww8/data/tdf71749_with_footnote.doc b/sw/qa/filter/ww8/data/tdf71749_with_footnote.doc new file mode 100644 index ..9de42a4aac11 Binary files /dev/null and b/sw/qa/filter/ww8/data/tdf71749_with_footnote.doc differ diff --git a/sw/qa/filter/ww8/data/tdf71749_without_footnote.doc b/sw/qa/filter/ww8/data/tdf71749_without_footnote.doc new file mode 100644 index ..cf0b647f1066 Binary files /dev/null and b/sw/qa/filter/ww8/data/tdf71749_without_footnote.doc differ diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx index 9a1b919c0cc8..1838210ed9d8 100644 --- a/sw/qa/filter/ww8/ww8.cxx +++ b/sw/qa/filter/ww8/ww8.cxx @@ -642,6 +642,22 @@ CPPUNIT_TEST_FIXTURE(Test, testContentControlPDFDropDownEmptyItem) // i.e. we emitted an empty list item, so the result can't be opened in Word. assertXPath(pXmlDoc, "//w:dropDownList/w:listItem"_ostr, 1); } + +CPPUNIT_TEST_FIXTURE(Test, tdf71749_with_footnote) +{ +// Without the fix in place, +// loading the document would hang. +loadFromFile(u"tdf71749_with_footnote.doc"); +CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + +CPPUNIT_TEST_FIXTURE(Test, tdf71749_without_footnote) +{ +// Without the fix in place, +// loading the document would hang. +loadFromFile(u"tdf71749_without_footnote.doc"); +CPPUNIT_ASSERT_EQUAL(1, getPages()); +} } CPPUNIT_PLUGIN_IMPLEMENT();
GSOC More and Better tests update
Hello, As mentioned in the last update, I was working on creating the test documents from scratch for test found here https://gerrit.libreoffice.org/c/core/+/170169 <https://gerrit.libreoffice.org/c/core/+/170169> Unfortunately I wasn’t able to succeed. The test depends on a table inserted into a footnote, which then causes an infinite loop when the document is imported into LO. As commented on in the bug report, inserting a table into a footnote is greyed out in the UI, and so it wasn’t possible to even see if that was the only dependency in the test file. After trying several different methods of creating tables, footnotes and trying different methods of inserting tables into the footnotes, I couldn’t reproduce the bug. So in the interest of time, I’m leaving the test as is, using the test document. Next up is tdf#157482, which I’ve finished writing the test for, it can be found here https://gerrit.libreoffice.org/c/core/+/170535 <https://gerrit.libreoffice.org/c/core/+/170535> The test is written in Python, since its a pure UI test. Everything seems to working ok, so hopefully I can get it to pass CI with minor changes. While working on the tests last week, I started to get some strange compile errors that I have never encountered before. During my weekly meeting with Xisco and Hossein, they pointed out that the problem was with Gallery, but we were unable to solve the issue during the meeting. After trying to resolve the issue for some time, I found the —with-galleries=no flag for autopen.input, which at least let me compile. I’m still unable to run any instance of LO from the command line or the package installed from my operating system(Fedora). Today, I bit the bullet, created a new user, and built a new repository and everything works, which is a great relief. At some point I will go through the configurations to see if I can get my old repos to work again. For now, the plan is to keep writing tests, the next two in mind are https://bugs.documentfoundation.org/show_bug.cgi?id=157484 <https://bugs.documentfoundation.org/show_bug.cgi?id=157484> https://bugs.documentfoundation.org/show_bug.cgi?id=85769 <https://bugs.documentfoundation.org/show_bug.cgi?id=85769> That’s it for this week, until next week, Adam Seskunas
Re: Strange Compile error
Attached is the zipped log output. I'm working on running the last command in gdb as suggested by Noel. Here is the command in case it helps with debugging. S=/home/adam/libreoffice3 && I=$S/instdir && W=$S/workdir && rm -f $W/Gallery/backgrounds/* && RESPONSEFILE=/tmp/gbuild.ldBiE8 && ( ( LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"$I/program:$I/program" $I/program/gengal.bin --build-tree --destdir file://$S/extras/source/gallery --name "backgrounds" --path $W/Gallery/backgrounds --filenames file://$RESPONSEFILE -env:UserInstallation=file://$W/Gallery/backgrounds/user ) > $W/Gallery/backgrounds.done.log 2>&1 || ( cat $W/Gallery/backgrounds.done.log && false ) ) && rm $RESPONSEFILE && touch $W/Gallery/backgrounds.done On Fri, Jul 12, 2024 at 1:53 AM Hossein Nourikhah wrote: > Hello Adam, > > To diagnose the problem, more detailed output is needed. You can invoke: > > $ make -n Gallery > log.txt > $ bzip2 log.txt > > Then, could you please send the compressed log.txt.bz2? Then it may be > possible to find out what is causing the issue. Please add me as cc. > > Regards, > Hossein > > On 11.07.2024 21:53, Adam Seskunas wrote: > > Hello, > > > > I've run into the following error when running make > > > > warn:vcl:924651:924651:vcl/source/app/svapp.cxx:249: AppFileName > > should be set to something after SVMain! > > Bootstrap exception 'component context fails to supply service > > com.sun.star.ucb.UniversalContentBroker of type > > com.sun.star.ucb.XUniversalContentBroker at > > > /home/adam/libreoffice3/workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/ucb/UniversalContentBroker.hpp:52' > > warn:vcl:924655:924655:vcl/source/app/svapp.cxx:249: AppFileName > > should be set to something after SVMain! > > Bootstrap exception 'component context fails to supply service > > com.sun.star.ucb.UniversalContentBroker of type > > com.sun.star.ucb.XUniversalContentBroker at > > > /home/adam/libreoffice3/workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/ucb/UniversalContentBroker.hpp:52' > > make[1]: *** [/home/adam/libreoffice3/solenv/gbuild/Gallery.mk:57: > > /home/adam/libreoffice3/workdir/Gallery/backgrounds.done] Error 1 > > make[1]: *** Waiting for unfinished jobs > > make[1]: *** [/home/adam/libreoffice3/solenv/gbuild/Gallery.mk:57: > > /home/adam/libreoffice3/workdir/Gallery/sounds.done] Error 1 > > make: *** [Makefile:295: build] Error 2 > > > > This is from a brand new repo, downloaded this morning from > > https://gerrit.libreoffice.org/core. > > I started getting the same error yesterday, in my main repo used for > > development, while > > writing a test. I've also tried a make clean, and make distclean on > > my main repo and get the same error when running make on the cleaned > > repo. > > > > Seems like it might be a configuration problem, so here's my system > > information via uname -a > > > > Linux 6.9.7-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 27 > > 18:11:45 UTC 2024 x86_64 GNU/Linux > > > > Any help would be greatly appreciated, > > Adam Seskunas > > -- > Hossein Nourikhah, Ph.D., Developer Community Architect > Tel: +49 30 5557992-65 | Email: hoss...@libreoffice.org > The Document Foundation, Winterfeldtstraße 52, 10781 Berlin, DE > Gemeinnützige rechtsfähige Stiftung des bürgerlichen Rechts > Legal details: https://www.documentfoundation.org/imprint > log.txt.bz2 Description: BZip2 compressed data
Strange Compile error
Hello, I've run into the following error when running make warn:vcl:924651:924651:vcl/source/app/svapp.cxx:249: AppFileName should be set to something after SVMain! Bootstrap exception 'component context fails to supply service com.sun.star.ucb.UniversalContentBroker of type com.sun.star.ucb.XUniversalContentBroker at /home/adam/libreoffice3/workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/ucb/UniversalContentBroker.hpp:52' warn:vcl:924655:924655:vcl/source/app/svapp.cxx:249: AppFileName should be set to something after SVMain! Bootstrap exception 'component context fails to supply service com.sun.star.ucb.UniversalContentBroker of type com.sun.star.ucb.XUniversalContentBroker at /home/adam/libreoffice3/workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/ucb/UniversalContentBroker.hpp:52' make[1]: *** [/home/adam/libreoffice3/solenv/gbuild/Gallery.mk:57: /home/adam/libreoffice3/workdir/Gallery/backgrounds.done] Error 1 make[1]: *** Waiting for unfinished jobs make[1]: *** [/home/adam/libreoffice3/solenv/gbuild/Gallery.mk:57: /home/adam/libreoffice3/workdir/Gallery/sounds.done] Error 1 make: *** [Makefile:295: build] Error 2 This is from a brand new repo, downloaded this morning from https://gerrit.libreoffice.org/core. I started getting the same error yesterday, in my main repo used for development, while writing a test. I've also tried a make clean, and make distclean on my main repo and get the same error when running make on the cleaned repo. Seems like it might be a configuration problem, so here's my system information via uname -a Linux 6.9.7-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 27 18:11:45 UTC 2024 x86_64 GNU/Linux Any help would be greatly appreciated, Adam Seskunas
GSOC More and Better Tests weekly update
Hello, This week I've finished working on the CRM Database port and used it to finish porting the Junit test that was located in dbaccess/qa/complex/dbacces/DataSource.java. The file dbaccess/qa/unit/CRMdatabase_test.cxx now contains two tests, one for the CRM Database, testing that it can be created, inserted into and some prepared queries are prepared and can be used to return the correct results. And the second test is the port of the Junit DataSource test, which now uses the CRM Database to register a new datasource as well as check if the Bibliography datasource is available and has the correct name. The patch has been merged and can be found here https://gerrit.libreoffice.org/c/core/+/169071 While working on the CRMDatabase tests I started working on some Missing Unit tests. Hossein gave me some help on reverting bug fixes in order to reproduce bugs for testing. The help paid off as I was able to easily reproduce https://bugs.documentfoundation.org/show_bug.cgi?id=71749 by manually changing the code. The tests were trivial to write, I'm currently working on eliminating the need for the test files, by reproducing the document within the test, thereby saving space in the LO build. The test can be found here https://gerrit.libreoffice.org/c/core/+/170169 Last of all, I've started working on writing some UI tests in python for the two related bug fixes/feature requests https://bugs.documentfoundation.org/show_bug.cgi?id=157482 https://bugs.documentfoundation.org/show_bug.cgi?id=157484 I have the test for tdf#15742 mostly finished, I've just been stalled a bit by correctly detecting the infoBar. After these tests are finished, my current plan is to at some point convert them to CppUnit. That's it for now, have a good week Adam Seskunas
GSOC More and Better Tests: Weekly Update
Hello all, This week I’ve continued working on porting the Java code that creates the CRMDatabase. There were a few issues that made it a little more difficult than it seemed when first looking at the code. The first problem involved imports in the make files. When writing code to test out the ported functions, I didn’t include the correct imports in the makefiles, which manifested itself in run time errors that were non-obvious to me. After talking about it with Xisco over Gerrit code review, Xisco identified the problem, we introduced the correct imports and got everything working. The second issue that I ran into was the code that connects to the database using XConnection was interfering with the code that created the prepared queries using XDataSource. This was causing more run time errors that were not indicative of the root problem. After getting stuck on the issue, I lucked into the solution when running the code through the debugger, having to comment out the database connection in order to debug the relevant code. My take away from all this is to be more careful when testing pieces of code, and to try and test in isolation if possible and to always try the debugger first. The CRMDatabase patch has been merged here, so a test database can now be used in CppUnit tests! The test in CRMDatabase_test can be used as an example of how to get the necessary interfaces, and how to query from the database, etc. https://gerrit.libreoffice.org/c/core/+/169573/8/dbaccess/qa/unit/CRMDatabase_test.cxx <https://gerrit.libreoffice.org/c/core/+/169573/8/dbaccess/qa/unit/CRMDatabase_test.cxx> The next steps are to use the new database in these tests that are waiting here https://gerrit.libreoffice.org/c/core/+/169071 <https://gerrit.libreoffice.org/c/core/+/169071> After that, there are some more tests in dbaccess/complex that use the CRMDatabase that I will work on porting to CppUnit. I have also spent some time on the Missing Unit test list. So far, I’ve not been able to get any of the bugs to reproduce when reverting to the pre bug fix commits. I will continue to try on new bugs, or with other techniques, in between writing other tests. That’s if for this week, Adam Seskunas
GSOC More and Better Tests: Weekly Update
Hello, This is my weekly update for my More and Better Tests GSOC project. After submitting patch https://gerrit.libreoffice.org/c/core/+/169071 <https://gerrit.libreoffice.org/c/core/+/169071>, last week and during code review discussions, it was decided that porting over the Customer Relationship Management database located in connectivity/qa/connectivity/tools/CRMDatabase.java would be my next step. Porting the setup of this database to C++ will allow the tests in dbaccess/qa/extras/dataSource.cxx to follow the original java tests as closely as possible. And as mentioned in last weeks email, it will also allow for more database java tests to be ported over to CppUnit. The first step in this process was completed by Xisco here https://gerrit.libreoffice.org/c/core/+/169274 <https://gerrit.libreoffice.org/c/core/+/169274>. This patch allows for a convenient and standardised way to load a database document. The next step is to port over the createTables and createQueries functions from the CRMDatabase.java file to dbtest_access.cxx. Adding these functions to dbtest_access will allow the CRMDatabase to be easily set up and accessed for testing. After having gotten createTables and creatreQueries ported over to C++, I’ve discovered during testing that, although the code compiles, it isn’t actually working. The SQL isn’t being accepted by the hsql database and the errors were being suppressed. So at the current moment, I’m troubleshooting the the createTables function. As soon as the code is working, the rest of the work on porting the functions is done, so it will be easy to submit the patch. As mentioned in last weeks email, I also started working on porting over some tests from the Missing Unit test list. I ran into some problems reverting to the correct commits to re produce the bugs. During our weekly meeting, Xisco and Hossein offered some very helpful tips, and I will use these over the upcoming week to hopefully make some progress on writing some Missing Unit tests. Have a good week, Adam Seskunas
GSOC More and Better Tests: Weekly Update
Hello everyone, This past week I continued working on the pesky checkdispatchapi.java tests. Xisco has come up with a roll out plan, to get the tests working/resolve the issues in stages. There is another patch set here https://gerrit.libreoffice.org/c/core/+/168694 <https://gerrit.libreoffice.org/c/core/+/168694> with most of the tests enabled, and currently building with no problems. The next stage still needs to be completed, and that will entail getting the test windows to close cleanly, and getting the last three database tests to build without errors. I also continued to work on porting the checkInterception() test, located in checkdispatchapi.java. By the end of the week, I had gotten stuck translating the Interceptor.java helper class over to c++. Xisco kindly suggested that since I had already written a few database adjacent tests, that I look into the the dbaccess/qa/complex tests to maybe give one a try, for a change of pace. I found dbaccess/qa/complex/dbaccess/DataSource.java and have ported that over to CppUnit. The patch can be found here https://gerrit.libreoffice.org/c/core/+/169071 <https://gerrit.libreoffice.org/c/core/+/169071> There are at least two other tests in dbaccess/qa/complex that I’m interested in porting over to CppUnit. The issue is that they rely on the "Customer Relationship Management” database that is set up in connectivity/qa/connectivity/tools/CRMDatabase.java. The idea I have is to save that database to file, then it will be a simple matter to perform the other tests by just opening the test file, no need to set up the database tables and queries for each test or to translate the setup code to c++. If anyone has any suggestions on how to do this, feel free to chime in, I will be working on it this week. This week I will also be working on porting over some tests from the Missing Unit Test list. The plan is to start with here https://bugs.documentfoundation.org/show_bug.cgi?id=85769 <https://bugs.documentfoundation.org/show_bug.cgi?id=85769> and if time allows, write this test as well https://bugs.documentfoundation.org/show_bug.cgi?id=103063 <https://bugs.documentfoundation.org/show_bug.cgi?id=103063> That’s it for now, hope everyone has a good week. Cheers, Adam Seskunas
GSOC More and Better Tests: Weekly Update
Hello everyone, This is my weekly GSOC update, for week 3. Seems like time is flying by! Last week I finished porting over some of the tests in framework/qa/complex/dispatches/checkdispatchapi.java. The Gerrit submission can be found here https://gerrit.libreoffice.org/c/core/+/168482 <https://gerrit.libreoffice.org/c/core/+/168482> This patch covers the checkDispatchOfXXX tests, including the three database tests. The database tests and supporting code had been disabled for quite some time, so when the patch gets merged, the tests will hopefully be re-enabled after a long hiatus. While looking over the submission, Xisco noticed that something funny was happening with the Frames in each test, they aren’t getting closed out by the testing infrastructure. So after being alerted to this, I spent some time working on the issue and have gotten the non-database frames to close, but I’m currently blocked on getting the three database related frames to behave. Next up, I’ve started working on porting over the last three tests in checkdispatchapi.java, checkInterceptorLifeTime(), checkInterception() and checkDispatchInfoOfBasic/StartModule(). The Interceptor tests have a class of supporting code, located in framework/qa/complex/dispatches/Interceptor.java. I’ve currently got the code for the class ported, but not in a functioning state. If all goes well with the supporting class, the porting of the tests should be done in the next two days. Next up would be framework/qa/complex/api_internal/CheckAPI.java, and after that I’m going to start working on writing some tests from the Missing Unit tests list. Cheers, Adam Seskunas
core.git: framework/CppunitTest_framework_checkDispatchAPI.mk framework/Module_framework.mk framework/qa
framework/CppunitTest_framework_checkDispatchAPI.mk | 43 framework/Module_framework.mk |1 framework/qa/cppunit/checkDispatchAPI.cxx | 196 framework/qa/cppunit/data/checkDispatchAPIDB.odb|binary 4 files changed, 240 insertions(+) New commits: commit 227f5c77278c96f7f1b126aade457422949a095c Author: Adam Seskunas AuthorDate: Wed Jun 5 14:54:19 2024 -0700 Commit: Xisco Fauli CommitDate: Fri Jun 7 10:45:17 2024 +0200 framework/qa/complex/dispatches/checkdispatchapi.java to CppUnit Ports the checkDispatchOfXXX tests including the three database dependent tests. The other tests in the file will be ported in another commit, to be merged with this one. Change-Id: I6bcbcbf91ad4d9cc52c817f4efef9779a17f2198 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168482 Tested-by: Jenkins Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli diff --git a/framework/CppunitTest_framework_checkDispatchAPI.mk b/framework/CppunitTest_framework_checkDispatchAPI.mk new file mode 100644 index ..94aa88d43d5b --- /dev/null +++ b/framework/CppunitTest_framework_checkDispatchAPI.mk @@ -0,0 +1,43 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,framework_checkDispatchAPI)) + +$(eval $(call gb_CppunitTest_add_exception_objects,framework_checkDispatchAPI, \ +framework/qa/cppunit/checkDispatchAPI \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,framework_checkDispatchAPI)) + +$(eval $(call gb_CppunitTest_use_libraries,framework_checkDispatchAPI, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + salhelper \ + subsequenttest \ + test \ + unotest \ + utl \ + tl \ + vcl \ +)) + +$(eval $(call gb_CppunitTest_use_external,framework_checkDispatchAPI,boost_headers)) + +$(eval $(call gb_CppunitTest_use_sdk_api,framework_checkDispatchAPI)) + +$(eval $(call gb_CppunitTest_use_ure,framework_checkDispatchAPI)) +$(eval $(call gb_CppunitTest_use_vcl,framework_checkDispatchAPI)) + +$(eval $(call gb_CppunitTest_use_rdb,framework_checkDispatchAPI,services)) + +$(eval $(call gb_CppunitTest_use_configuration,framework_checkDispatchAPI)) + +# vim: set noet sw=4 ts=4: diff --git a/framework/Module_framework.mk b/framework/Module_framework.mk index 7521418d3861..8f700010444f 100644 --- a/framework/Module_framework.mk +++ b/framework/Module_framework.mk @@ -29,6 +29,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,framework,\ CppunitTest_framework_dispatch \ CppunitTest_framework_loadenv \ CppunitTest_framework_CheckXTitle \ + CppunitTest_framework_checkDispatchAPI \ )) # Not sure why this is not stable on macOS. diff --git a/framework/qa/cppunit/checkDispatchAPI.cxx b/framework/qa/cppunit/checkDispatchAPI.cxx new file mode 100644 index ..0536690addd0 --- /dev/null +++ b/framework/qa/cppunit/checkDispatchAPI.cxx @@ -0,0 +1,196 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +using namespace ::com::sun::star; + +namespace +{ +class DispatchAPITest : public UnoApiTest +{ +public: +DispatchAPITest() +: UnoApiTest(u"/framework/qa/cppunit/data/"_ustr) +{ +} +void checkDispatchInfo(uno::Reference xFrame); +uno::Reference loadComponent(OUString url); +uno::Reference loadWithDBComponent(OUString url); +}; + +uno::Reference DispatchAPITest::loadComponent(OUString url) +{ +uno::Reference xDesktop += css::frame::Desktop::create(comphelper::getProcessComponentContext()); +uno::Reference xFrame = xDesktop->findFrame(u"_blank"_ustr, 0); +uno::Reference xComponentLoader(xFrame, uno::UNO_QUERY); +uno::Sequence aLoadArgs{ comphelper::makePropertyValue(u"Hidden"_ustr, + false) }; +uno::Reference xComponent += xComponentLoader->loadComponentFromURL(url, u"_default"_ustr, 0, aLoadArgs); +CPPUNIT_ASSERT(xComponent.is()); + +return xFrame; +} + +uno::Reference DispatchAPITest::loadWithDBComponent(OUString url) +{ +uno::Reference xDesktop += css::frame::Desktop::create(comphelper::getProcessC
core.git: framework/CppunitTest_framework_CheckXTitle.mk framework/JunitTest_framework_complex.mk framework/Module_framework.mk framework/qa
framework/CppunitTest_framework_CheckXTitle.mk | 43 +++ framework/JunitTest_framework_complex.mk |2 framework/Module_framework.mk |1 framework/qa/complex/XTitle/CheckXTitle.java | 325 - framework/qa/cppunit/CheckXTitle.cxx | 158 5 files changed, 202 insertions(+), 327 deletions(-) New commits: commit 4078428a401f4a99045451b59863d6001cdcc20b Author: Adam Seskunas AuthorDate: Tue May 28 10:33:38 2024 -0700 Commit: Xisco Fauli CommitDate: Tue Jun 4 09:11:39 2024 +0200 Port framework/qa/complex/XTitle/CheckXTile.java to Cppunit framework - Remove CheckXTitle.java from makefiles - Create new makefile for CheckXTitle framework qa complex XTitle - Remove JUnit test framework qa cppunit - Add new CppUnit test suit CheckXTitle.cxx - checkDefaultTitle: tests if default title is the same after cycling through the default window and print preview - checkTitleDefaultFileName: tests if a window title set with SuggestedSaveAs is in fact set with said name - setTitleAndCheck: tests if after setting window title and cycling through default window and print preview, there is infinite recursion Change-Id: If7794f0f853ef427bb735a22752cff3635f5ff63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168168 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/framework/CppunitTest_framework_CheckXTitle.mk b/framework/CppunitTest_framework_CheckXTitle.mk new file mode 100644 index ..59f02421f5ed --- /dev/null +++ b/framework/CppunitTest_framework_CheckXTitle.mk @@ -0,0 +1,43 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CppunitTest_CppunitTest,framework_CheckXTitle)) + +$(eval $(call gb_CppunitTest_add_exception_objects,framework_CheckXTitle, \ +framework/qa/cppunit/CheckXTitle \ +)) + +$(eval $(call gb_CppunitTest_use_sdk_api,framework_CheckXTitle)) + +$(eval $(call gb_CppunitTest_use_libraries,framework_CheckXTitle, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + salhelper \ + subsequenttest \ + test \ + unotest \ + utl \ + tl \ + vcl \ +)) + +$(eval $(call gb_CppunitTest_use_external,framework_CheckXTitle,boost_headers)) + +$(eval $(call gb_CppunitTest_use_sdk_api,framework_CheckXTitle)) + +$(eval $(call gb_CppunitTest_use_ure,framework_CheckXTitle)) +$(eval $(call gb_CppunitTest_use_vcl,framework_CheckXTitle)) + +$(eval $(call gb_CppunitTest_use_rdb,framework_CheckXTitle,services)) + +$(eval $(call gb_CppunitTest_use_configuration,framework_CheckXTitle)) + +# vim: set noet sw=4 ts=4: diff --git a/framework/JunitTest_framework_complex.mk b/framework/JunitTest_framework_complex.mk index 30f24b810458..a582235b8d41 100644 --- a/framework/JunitTest_framework_complex.mk +++ b/framework/JunitTest_framework_complex.mk @@ -58,12 +58,10 @@ $(eval $(call gb_JunitTest_add_sourcefiles,framework_complex,\ framework/qa/complex/dispatches/checkdispatchapi \ framework/qa/complex/dispatches/Interceptor \ framework/qa/complex/ModuleManager/CheckXModuleManager \ -framework/qa/complex/XTitle/CheckXTitle \ )) $(eval $(call gb_JunitTest_add_classes,framework_complex,\ complex.dispatches.checkdispatchapi \ -complex.XTitle.CheckXTitle \ )) # these were disabled in the old build system too, please check # carefully before reenabling diff --git a/framework/Module_framework.mk b/framework/Module_framework.mk index 924989d0672a..7521418d3861 100644 --- a/framework/Module_framework.mk +++ b/framework/Module_framework.mk @@ -28,6 +28,7 @@ $(eval $(call gb_Module_add_targets,framework,\ $(eval $(call gb_Module_add_slowcheck_targets,framework,\ CppunitTest_framework_dispatch \ CppunitTest_framework_loadenv \ + CppunitTest_framework_CheckXTitle \ )) # Not sure why this is not stable on macOS. diff --git a/framework/qa/complex/XTitle/CheckXTitle.java b/framework/qa/complex/XTitle/CheckXTitle.java deleted file mode 100644 index e20697eba974.. --- a/framework/qa/complex/XTitle/CheckXTitle.java +++ /dev/null @@ -1,325 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE
GSOC More and Better Tests: Weekly Update
Hello everyone, This is my weekly update for More and Better tests. Last week I finished porting framework/qa/complex/XTitle/CheckXTitle.java over to CppUnit. The patch is in Gerrit here https://gerrit.libreoffice.org/c/core/+/168168 <https://gerrit.libreoffice.org/c/core/+/168168> Xisco has noted that, if commit 4355137901e18e24de2ab123fd0454147f1f3890 is reverted, the test fails, which means the test is working as intended. Hopefully having this test in c++ will help anyone in the future who runs into a test failure by making the test easier to understand and easier to debug. After submitting CheckXTitle to Gerrit, I began working on framework/qa/complex/checkdispatchapi.java. After talking it over with Xisco and Hossein, it was decided to split this test into two Gerrit submissions, one for the database portion and one for everything else in the test suite. The database portion of the test suite had been disabled and the hope is to be able to get it working in CppUnit again. Submitting it separately will allow some time for CI testing while I finish porting the rest of the test suite. As of now, I’m close to getting the first part submitted, I’ve been reading the Developers Guide database documentation and working on importing the database components with a database connection. After finishing the porting of checkdispatchapi.java, I tentatively plan to start working on framework/qa/complex/api_internal/CheckAPI.java. Have a good week, Adam Seskunas
GSOC More and Better Tests: Weekly Update
Hello everyone, Here is my weekly update for my GSOC project, More and Better Tests. On Thursday, I met with Hossein and Xisco, we discussed the timeline for the project and some specifics around the porting of JUnit tests to CppUnit. We discussed updating the project proposal timeline to reflect which tests will be written and when. The updated proposal can be found on NextCloud here https://nextcloud.documentfoundation.org/f/1548953 <https://nextcloud.documentfoundation.org/f/1548953>, the specific tests I will be working on are mentioned in the timeline. We decided that I should start with porting framework/qa/complex/XTitle/CheckXTitle.java and framework/qa/complex/desktop/DesktopTerminate.java. These two tests are enabled and currently pass, which should make the process of porting to CppUnit a little easier. I started working on the first test; framework/qa/complex/XTitle/CheckXTitle.java making some good progress and should hopefully have something submitted to Gerrit later this afternoon or tomorrow morning at the latest. Currently I’m planning on submitting the JUnit ports under this https://bugs.documentfoundation.org/show_bug.cgi?id=45904 <https://bugs.documentfoundation.org/show_bug.cgi?id=45904> bug report in Gerrit, unless anyone has any opinions that they should go elsewhere. That’s it for now, in the coming week I’m going to be working on porting my first four tests. Cheers, Adam Seskunas
GSoC Project Introduction: More and Better Tests
Hello Everyone, My name is Adam Seskunas and I'm one of the GSoC contributors for LibreOffice. My project, as the name suggests, is to write more and better tests for LibreOffice. In particular, I will be focusing on writing filter tests for writer. The project will consist of two main parts, the first of which will be to convert some JUnit tests to CppUnit, and the second part will consist of writing missing unit tests. A more detailed description as well as a link to the project proposal can be found here https://summerofcode.withgoogle.com/myprojects/details/pUU5JIpy I'd like to take this opportunity to thank Hossein and Xisco for agreeing to mentor me through the project. And I'd like to give a big thanks to Ilmari for helping me get involved with LibreOffice over the past year and encouraging me to apply for the GSoC. And last of all, a big thanks to all of the community members, everyone has been welcoming and friendly, it's been a very positive experience contributing to LibreOffice. In the next week I will be working on refining the list of tests I will be working on and gathering information about each test I plan to work on. In my next update I hope to have a finalized list of tests to publish. Adam Seskunas
core.git: sw/CppunitTest_sw_filter_ascii.mk sw/Module_sw.mk sw/qa sw/source
sw/CppunitTest_sw_filter_ascii.mk | 76 ++ sw/Module_sw.mk |1 sw/qa/filter/ascii/ascii.cxx | 153 ++ sw/source/filter/ascii/wrtasc.cxx | 59 ++ sw/source/filter/ascii/wrtasc.hxx |1 5 files changed, 289 insertions(+), 1 deletion(-) New commits: commit 3e7de6b1bc9f28ba6b69489e7f5c7dc645abc695 Author: Adam Seskunas AuthorDate: Thu Mar 14 06:09:08 2024 -0700 Commit: Hossein CommitDate: Tue May 14 18:56:44 2024 +0200 tdf#144576 Copy a table from Writer to plain text editor as a Matrix sw ascii filter - check for table nodes, output them seperately with formating to be displayed as a matrix when copy/pasted to a text file sw qa filter ascii - add new test suite along with test to check for correct output Change-Id: I8ca31bced3860e8e9752db8530ea6caaf31f2e5e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164833 Reviewed-by: Hossein Tested-by: Jenkins diff --git a/sw/CppunitTest_sw_filter_ascii.mk b/sw/CppunitTest_sw_filter_ascii.mk new file mode 100644 index ..85a648c8ec69 --- /dev/null +++ b/sw/CppunitTest_sw_filter_ascii.mk @@ -0,0 +1,76 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#* +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +#* + +$(eval $(call gb_CppunitTest_CppunitTest,sw_filter_ascii)) + +$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_filter_ascii)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sw_filter_ascii, \ +sw/qa/filter/ascii/ascii \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sw_filter_ascii, \ +comphelper \ +cppu \ +cppuhelper \ +editeng \ +sal \ +sfx \ +subsequenttest \ +svl \ +svx \ +svxcore \ +sw \ +swqahelper \ +test \ +unotest \ +utl \ +vcl \ +tl \ +)) + +$(eval $(call gb_CppunitTest_use_externals,sw_filter_ascii,\ +boost_headers \ +libxml2 \ +)) + +$(eval $(call gb_CppunitTest_set_include,sw_filter_ascii,\ +-I$(SRCDIR)/sw/inc \ +-I$(SRCDIR)/sw/source/core/inc \ +-I$(SRCDIR)/sw/source/uibase/inc \ +-I$(SRCDIR)/sw/qa/inc \ +$$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_api,sw_filter_ascii,\ + udkapi \ + offapi \ + oovbaapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,sw_filter_ascii)) +$(eval $(call gb_CppunitTest_use_vcl,sw_filter_ascii)) + +$(eval $(call gb_CppunitTest_use_rdb,sw_filter_ascii,services)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sw_filter_ascii,\ +officecfg/registry \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,sw_filter_ascii)) + +$(eval $(call gb_CppunitTest_use_uiconfigs,sw_filter_ascii, \ +modules/swriter \ +)) + +$(eval $(call gb_CppunitTest_use_more_fonts,sw_filter_ascii)) + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index fc2afe9fb7d9..2db6fbace5f5 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -167,6 +167,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_filter_ww8 \ CppunitTest_sw_filter_html \ CppunitTest_sw_filter_xml \ +CppunitTest_sw_filter_ascii \ CppunitTest_sw_a11y \ CppunitTest_sw_core_theme \ CppunitTest_sw_pdf_test \ diff --git a/sw/qa/filter/ascii/ascii.cxx b/sw/qa/filter/ascii/ascii.cxx new file mode 100644 index ..d6c4773ca40f --- /dev/null +++ b/sw/qa/filter/ascii/ascii.cxx @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace +{ +/** + * Covers sw/source/filter/ascii/ fixes. + * + * Note that these tests are meant to be simple: either load a file and assert some result or build + * a document model with code, export and assert that result. + * + * Keep using the various sw_import/export suites for multiple filter calls inside a single + * test. + */ +class Test : public SwModelTestBase +{ +public: +Test() +: SwModelTestBase("/sw/qa/filter/ascii/data/") +{ +} +}; + +CPPUNIT_TEST_FIXTURE(Test, testTdf144576_ascii) +{ +// Given a document with a 2x2 table +createSwDoc(); +SwDoc* pDoc = getSwDoc(); +SwWrtShell* pWrtShell = pDoc-&g
core.git: basic/CppunitTest_basic_macros.mk basic/qa vcl/source
basic/CppunitTest_basic_macros.mk |1 basic/qa/cppunit/data/tdf149714.png |binary basic/qa/cppunit/test_tdf149714.cxx | 86 vcl/source/graphic/UnoGraphicDescriptor.cxx |2 4 files changed, 88 insertions(+), 1 deletion(-) New commits: commit 9071cd6e59fb98ad8a2ddfb1019eaf950c716722 Author: Adam Seskunas AuthorDate: Sat Feb 24 21:19:37 2024 -0800 Commit: Mike Kaganski CommitDate: Wed Feb 28 05:00:46 2024 +0100 tdf#149714 BitsPerPixel property of Graphic has Boolean UNO type - vcl change UNO type of UnoGraphicProperty::BitsPerPixel to sal_Int8 instead of sal_uInt8 which maps to BOOLEAN causing Basic to convert non-0 values to True - basic add CppUnitTest since thats where the problem was occuring Change-Id: I099151fb5e001b6362e1359ad90bb039f064 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163899 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/basic/CppunitTest_basic_macros.mk b/basic/CppunitTest_basic_macros.mk index 9d8050e7b4e5..a67508f800a2 100644 --- a/basic/CppunitTest_basic_macros.mk +++ b/basic/CppunitTest_basic_macros.mk @@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,basic_macros, \ basic/qa/cppunit/test_vba \ basic/qa/cppunit/test_global_as_new \ basic/qa/cppunit/test_global_array \ + basic/qa/cppunit/test_tdf149714 \ )) $(eval $(call gb_CppunitTest_use_libraries,basic_macros, \ diff --git a/basic/qa/cppunit/data/tdf149714.png b/basic/qa/cppunit/data/tdf149714.png new file mode 100644 index ..d22b8451864d Binary files /dev/null and b/basic/qa/cppunit/data/tdf149714.png differ diff --git a/basic/qa/cppunit/test_tdf149714.cxx b/basic/qa/cppunit/test_tdf149714.cxx new file mode 100644 index ..76713508560c --- /dev/null +++ b/basic/qa/cppunit/test_tdf149714.cxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include +#include +#include +#include + +#include + +namespace +{ +class TestTdf149714 : public CppUnit::TestFixture +{ +void testBitsPerPixel(); + +CPPUNIT_TEST_SUITE(TestTdf149714); +CPPUNIT_TEST(testBitsPerPixel); +CPPUNIT_TEST_SUITE_END(); + +StarBASICRef interpreter; + +SbModuleRef Module() +{ +test::Directories aDirectories; +OUString aDataFileName += aDirectories.getURLFromSrc(u"basic/qa/cppunit/data/") + u"tdf149714.png"; +OUString sBasic = uR"BAS( + +Function GetBitsPerPixelAsString As String +DIM oProps(0) As New "com.sun.star.beans.PropertyValue" +DIM oProvider, oGraphic + +oProps(0).Name = "URL" +oProps(0).Value = "$PNGFILENAME" + +oProvider = createUnoService("com.sun.star.graphic.GraphicProvider") +oGraphic = oProvider.queryGraphic(oProps()) + +GetBitsPerPixelAsString = oGraphic.BitsPerPixel + +End Function + +)BAS"_ustr; + +sBasic = sBasic.replaceFirst("$PNGFILENAME", aDataFileName); + +interpreter = new StarBASIC(); +auto mod = interpreter->MakeModule("BitsPerPixel", sBasic); + +CPPUNIT_ASSERT(mod->Compile()); +CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, StarBASIC::GetErrBasic()); +CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, SbxBase::GetError()); +CPPUNIT_ASSERT(mod->IsCompiled()); +return mod; +} +}; + +void TestTdf149714::testBitsPerPixel() +{ +auto m = Module(); +auto GetBitsPerPixelAsString = m->FindMethod("GetBitsPerPixelAsString", SbxClassType::Method); +CPPUNIT_ASSERT_MESSAGE("Could not Find GetBitsPerPixelAsString in module", + GetBitsPerPixelAsString != nullptr); + +SbxVariableRef returned = new SbxMethod{ *GetBitsPerPixelAsString }; +CPPUNIT_ASSERT(returned->IsString()); + +// Without the fix in place this would fail with: +// - Expected: 24 +// - Actual: True +CPPUNIT_ASSERT_EQUAL(OUString{ "24" }, returned->GetOUString()); +} + +// Put the test suite in the registry +CPPUNIT_TEST_SUITE_REGISTRATION(TestTdf149714); + +} // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/graphic/UnoGraphicDescriptor.cxx b/vcl/source/graphic/UnoGraphicDescriptor.cxx index e83ac98959f8..32ffe48fd68f 100644 --- a/vcl/source/graphic/UnoGraphicDescriptor.cxx +++ b/vcl/source/graphic/UnoGraphicDescriptor.cxx @@ -236,7 +236,7 @@ rtl::Reference<::comphelper::PropertySetInfo> GraphicDescriptor::create
core.git: basic/source
basic/source/runtime/methods.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 95dace2eb1ae7ce2fc000cc67e134b7bfadf2c35 Author: Adam Seskunas AuthorDate: Thu Feb 8 21:41:13 2024 -0800 Commit: Mike Kaganski CommitDate: Tue Feb 13 05:51:04 2024 +0100 tdf#154285 Check upper bound of arguments in SbRtl_CurDir The LibreOffice Basic specification says CurDir should accept one argument and in the case of a non-Windows system, ignore that argument and simply return the current directory. So check that SbRtl_CurDir accepts a maximum of two arguments. Change-Id: Ia60114fac31aa4261c8251e26ef172a0370e6abc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163150 Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index d58a2cef9ee0..34d959669747 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -371,6 +371,9 @@ void SbRtl_CurDir(StarBASIC *, SbxArray & rPar, bool) // there's no possibility to detect the current one in a way that a virtual URL // could be delivered. +if (rPar.Count() > 2) + return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); + #if defined(_WIN32) int nCurDir = 0; // Current dir // JSM if (rPar.Count() == 2)
core.git: sw/source
sw/source/core/inc/frmtool.hxx|8 sw/source/core/layout/frmtool.cxx |8 2 files changed, 8 insertions(+), 8 deletions(-) New commits: commit 07059f3336f0daea15c0574a67bd99986eccedd3 Author: Adam Seskunas AuthorDate: Sat Dec 30 18:45:28 2023 -0800 Commit: Hossein CommitDate: Wed Jan 17 14:33:51 2024 +0100 tdf#90341 Clean up excessive const_cast'ing Make SwBorderAttrs::CalcJoinedWithNext and SwBorderAttrs::CalcJoinedWithPrev member functions const, and make m_bJoinedWithNext and m_bJoinedWithPrev mutable since they are cached values, in order to remove a const_cast in CalcJoinedWithNext and CalcJoinedWithPrev. Change-Id: I8d75bde49646540cfa0af09c2d6f5461c5ace6d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161459 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index ffc218b5504e..f56b298938b3 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -339,8 +339,8 @@ class SwBorderAttrs final : public SwCacheObj mutable bool m_bCachedJoinedWithPrev : 1; mutable bool m_bCachedJoinedWithNext : 1; // Booleans indicate that borders are joined with previous/next frame. -bool m_bJoinedWithPrev :1; -bool m_bJoinedWithNext :1; +mutable bool m_bJoinedWithPrev :1; +mutable bool m_bJoinedWithNext :1; // The cached values (un-defined until calculated for the first time) sal_uInt16 m_nTopLine, @@ -375,8 +375,8 @@ class SwBorderAttrs final : public SwCacheObj // #i25029# - If <_pPrevFrame> is set, its value is taken for testing, if // borders/shadow have to be joined with previous frame. void CalcJoinedWithPrev( const SwFrame& _rFrame, - const SwFrame* _pPrevFrame ); -void CalcJoinedWithNext( const SwFrame& _rFrame ); + const SwFrame* _pPrevFrame ) const; +void CalcJoinedWithNext( const SwFrame& _rFrame ) const; // internal helper method for CalcJoinedWithPrev and CalcJoinedWithNext bool JoinWithCmp( const SwFrame& _rCallerFrame, diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index e8fa815776e2..45bf3597674b 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -2510,7 +2510,7 @@ bool SwBorderAttrs::JoinWithCmp( const SwFrame& _rCallerFrame, // previous frame. Calculated value saved in cached value // OD 2004-02-26 #i25029# - add 2nd parameter <_pPrevFrame> void SwBorderAttrs::CalcJoinedWithPrev( const SwFrame& _rFrame, - const SwFrame* _pPrevFrame ) + const SwFrame* _pPrevFrame ) const { // set default m_bJoinedWithPrev = false; @@ -2544,7 +2544,7 @@ void SwBorderAttrs::CalcJoinedWithPrev( const SwFrame& _rFrame, // OD 21.05.2003 #108789# - method to determine, if borders are joined with // next frame. Calculated value saved in cached value -void SwBorderAttrs::CalcJoinedWithNext( const SwFrame& _rFrame ) +void SwBorderAttrs::CalcJoinedWithNext( const SwFrame& _rFrame ) const { // set default m_bJoinedWithNext = false; @@ -2581,7 +2581,7 @@ bool SwBorderAttrs::JoinedWithPrev( const SwFrame& _rFrame, if ( !m_bCachedJoinedWithPrev || _pPrevFrame ) { // OD 2004-02-26 #i25029# - pass <_pPrevFrame> as 2nd parameter -const_cast(this)->CalcJoinedWithPrev( _rFrame, _pPrevFrame ); +CalcJoinedWithPrev( _rFrame, _pPrevFrame ); } return m_bJoinedWithPrev; @@ -2591,7 +2591,7 @@ bool SwBorderAttrs::JoinedWithNext( const SwFrame& _rFrame ) const { if ( !m_bCachedJoinedWithNext ) { -const_cast(this)->CalcJoinedWithNext( _rFrame ); +CalcJoinedWithNext( _rFrame ); } return m_bJoinedWithNext;
core.git: sw/qa
sw/qa/extras/layout/data/tdf147666.odt |binary sw/qa/extras/layout/data/tdf147666.png |binary sw/qa/extras/layout/layout3.cxx| 35 + 3 files changed, 35 insertions(+) New commits: commit ab70d0faf602de7d9711d99bd285a25c05335e9a Author: Adam Seskunas AuthorDate: Wed Nov 1 08:21:57 2023 -0700 Commit: Xisco Fauli CommitDate: Wed Jan 10 09:22:48 2024 +0100 tdf#147666 sw layout: add test case The test adds a large picture to the test document, and tests if the document correctly moves focus to the added picture. Change-Id: I10c6ac00510250c374391fe9a53d42b3df317bb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158761 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sw/qa/extras/layout/data/tdf147666.odt b/sw/qa/extras/layout/data/tdf147666.odt new file mode 100644 index ..23a09b50cabe Binary files /dev/null and b/sw/qa/extras/layout/data/tdf147666.odt differ diff --git a/sw/qa/extras/layout/data/tdf147666.png b/sw/qa/extras/layout/data/tdf147666.png new file mode 100644 index ..7e845d34dd24 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf147666.png differ diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index e4bfc5195b4b..8dc7b61645c3 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -2208,6 +2209,40 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf57187_Tdf158900) } } // end of anonymous namespace + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf147666) +{ +createSwDoc("tdf147666.odt"); + +// Move cursor into position to insert image +dispatchCommand(mxComponent, ".uno:GoToEndOfPara", {}); +dispatchCommand(mxComponent, ".uno:GoDown", {}); + +save("writer8"); +sal_Int32 nNonInsertedViewTop += getXPathContent(parseExport("settings.xml"), + "//config:config-item[@config:name='ViewTop']"_ostr) + .toInt32(); + +// Insert image below the end of the paragraph on page one +uno::Sequence aArgs = { +comphelper::makePropertyValue("FileName", createFileURL(u"tdf147666.png")), +}; +dispatchCommand(mxComponent, ".uno:InsertGraphic", aArgs); + +save("writer8"); +sal_Int32 nInsertedViewTop += getXPathContent(parseExport("settings.xml"), + "//config:config-item[@config:name='ViewTop']"_ostr) + .toInt32(); + +// Without the fix in place this will fail with +// nInsertedViewTop = nNonInsertedViewTop +// i.e. when the image is inserted, the view doesn't +// focus to the inserted graphic +CPPUNIT_ASSERT_LESS(nInsertedViewTop, nNonInsertedViewTop); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
core.git: dbaccess/uiconfig solenv/sanitizers
dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui | 15 +++ solenv/sanitizers/ui/dbaccess.suppr |3 --- 2 files changed, 15 insertions(+), 3 deletions(-) New commits: commit e4c8f63c90ad8396f22186045399fabcd65958cd Author: Adam Seskunas AuthorDate: Sat Dec 16 11:14:38 2023 -0800 Commit: Ilmari Lauhakangas CommitDate: Sun Dec 17 08:38:52 2023 +0100 tdf#119931 Fix accessibility warnings Fix accessibility warnings in: dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui Change-Id: I90eedb80db71d087a1bea5c2565809951d8c6f89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160874 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas diff --git a/dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui b/dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui index 0605fb00b18c..8a9141b250ae 100644 --- a/dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui +++ b/dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui @@ -25,6 +25,11 @@ + + +static + + False @@ -41,6 +46,11 @@ 72 72 0 + + +static + + False @@ -151,6 +161,11 @@ True False Default: 3306 + + +static + + False diff --git a/solenv/sanitizers/ui/dbaccess.suppr b/solenv/sanitizers/ui/dbaccess.suppr index 30a3a9243ed1..c5520105519d 100644 --- a/solenv/sanitizers/ui/dbaccess.suppr +++ b/solenv/sanitizers/ui/dbaccess.suppr @@ -53,9 +53,6 @@ dbaccess/uiconfig/ui/queryfilterdialog.ui://GtkLabel[@id='label7'] orphan-label dbaccess/uiconfig/ui/querypropertiesdialog.ui://GtkLabel[@id='limit-label'] orphan-label dbaccess/uiconfig/ui/querypropertiesdialog.ui://GtkLabel[@id='distinctvalues'] orphan-label dbaccess/uiconfig/ui/savedialog.ui://GtkLabel[@id='descriptionft'] orphan-label -dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui://GtkLabel[@id='header'] orphan-label -dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui://GtkLabel[@id='helpLabel'] orphan-label -dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui://GtkLabel[@id='portNumDefLabel'] orphan-label dbaccess/uiconfig/ui/postgrespage.ui://GtkLabel[@id='portNumDefLabel'] orphan-label dbaccess/uiconfig/ui/sortdialog.ui://GtkLabel[@id='label2'] orphan-label dbaccess/uiconfig/ui/sortdialog.ui://GtkLabel[@id='label3'] orphan-label
core.git: vcl/CppunitTest_vcl_pdfexport2.mk vcl/qa
vcl/CppunitTest_vcl_pdfexport2.mk | 10 + vcl/qa/cppunit/pdfexport/data/tdf113866.odt |binary vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 47 3 files changed, 57 insertions(+) New commits: commit 380081381ff3b3cae64a40c6cc2a82772cb663c1 Author: Adam Seskunas AuthorDate: Mon Dec 4 09:51:06 2023 -0800 Commit: Xisco Fauli CommitDate: Tue Dec 12 10:15:05 2023 +0100 tdf#113866 Add test. Test if font color persists when exporting to pdf *and* Print Text in Black is true. Change-Id: I20ccc59cad2e5c7b5d52c69673675fed61a76080 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160321 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/vcl/CppunitTest_vcl_pdfexport2.mk b/vcl/CppunitTest_vcl_pdfexport2.mk index 5574f515a7b0..1e3c3dc3b81c 100644 --- a/vcl/CppunitTest_vcl_pdfexport2.mk +++ b/vcl/CppunitTest_vcl_pdfexport2.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_pdfexport2, \ cppuhelper \ sal \ subsequenttest \ + sw \ test \ unotest \ utl \ @@ -32,9 +33,18 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_pdfexport2, \ $(eval $(call gb_CppunitTest_use_externals,vcl_pdfexport2, \ boost_headers \ + libxml2 \ $(if $(filter PDFIUM,$(BUILD_TYPE)),pdfium) \ )) +$(eval $(call gb_CppunitTest_set_include,vcl_pdfexport2,\ +-I$(SRCDIR)/sw/inc \ +-I$(SRCDIR)/sw/source/core/inc \ +-I$(SRCDIR)/sw/source/uibase/inc \ +-I$(SRCDIR)/sw/qa/inc \ +$$(INCLUDE) \ +)) + $(eval $(call gb_CppunitTest_use_sdk_api,vcl_pdfexport2)) $(eval $(call gb_CppunitTest_use_ure,vcl_pdfexport2)) diff --git a/vcl/qa/cppunit/pdfexport/data/tdf113866.odt b/vcl/qa/cppunit/pdfexport/data/tdf113866.odt new file mode 100644 index ..499bf4449a7e Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/tdf113866.odt differ diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index 8abb9dbe0fc6..deffb16785ce 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -38,6 +38,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -4851,6 +4856,48 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf156528) bounds.getHeight(), 1); } +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf113866) +{ +loadFromURL(u"tdf113866.odt"); + +// Set -- Printer Settings->Options->Print text in Black -- to true +SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get()); +SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); +IDocumentDeviceAccess& rDocAccess = pDoc->getIDocumentDeviceAccess(); +SwPrintData aDocPrintData = rDocAccess.getPrintData(); +aDocPrintData.SetPrintBlackFont(true); +rDocAccess.setPrintData(aDocPrintData); + +// Export to pdf +aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); +uno::Reference xStorable(mxComponent, uno::UNO_QUERY); +xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); + +// Parse the export result with pdfium. +std::unique_ptr pPdfDocument = parsePDFExport(); + +// Non-NULL pPdfDocument means pdfium is available. +if (pPdfDocument != nullptr) +{ +std::unique_ptr pPdfPage = pPdfDocument->openPage(0); +CPPUNIT_ASSERT(pPdfPage); + +int nPageObjectCount = pPdfPage->getObjectCount(); +for (int i = 0; i < nPageObjectCount; ++i) +{ +std::unique_ptr pPageObject = pPdfPage->getObject(i); + +if (pPageObject->getType() == vcl::pdf::PDFPageObjectType::Text) +// Without the bug fix in place the test will fail with +// - Expected: rgba[008000ff] +// - Actual : rgba[00ff] +// With the bug fixed, the green text in the test doc will stay green, +// when exported to pdf, while Print Text in Black is true +CPPUNIT_ASSERT_EQUAL(COL_GREEN, pPageObject->getFillColor()); +} +} +} + } // end anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: svtools/source
svtools/source/control/ctrlbox.cxx |4 ++-- svtools/source/control/valueset.cxx |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 1e6c1b672b1b93376f3c816e870d956b84e089e7 Author: Adam Seskunas AuthorDate: Wed Sep 20 13:54:44 2023 -0700 Commit: Hossein CommitDate: Fri Oct 20 03:37:45 2023 +0200 tdf#114441 Convert use of sal_uLong to better integer types In ctrlbox.cxx, nCount and i were changed to sal_uInt32 because aFontSizeNames.Count() returns sal_uInt32. In valueset.cxx, nFirstItem and nLastItem are only used in a comparison with a value of size_t. They were both changed to size_t because nLastItem contains the product of tools::Long mnVisLines and sal_uInt16 mnCols where tools::Long can be 64 bit in some cases. Change-Id: Ib3f10cdf6ae81e96f28f13a0bb32699f26c8a0cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157109 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 22bfde7febe5..3d4ce47b0814 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1186,8 +1186,8 @@ void FontSizeBox::Fill( const FontList* pList ) if ( pAry == FontList::GetStdSizeAry() ) { // for scalable fonts all font size names -sal_uLong nCount = aFontSizeNames.Count(); -for( sal_uLong i = 0; i < nCount; i++ ) +sal_uInt32 nCount = aFontSizeNames.Count(); +for( sal_uInt32 i = 0; i < nCount; i++ ) { OUString aSizeName = aFontSizeNames.GetIndexName( i ); int nSize = aFontSizeNames.GetIndexSize( i ); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 89ce7f8cdb23..87696d1a7886 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1076,8 +1076,8 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) } // draw items -sal_uLong nFirstItem = static_cast(mnFirstLine) * mnCols; -sal_uLong nLastItem = nFirstItem + (mnVisLines * mnCols); +size_t nFirstItem = static_cast(mnFirstLine) * mnCols; +size_t nLastItem = nFirstItem + (mnVisLines * mnCols); maItemListRect.SetLeft( x ); maItemListRect.SetTop( y );
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/escherex.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit d039fcd1cc6ce1f746b412f364790614bf972740 Author: Adam Seskunas AuthorDate: Thu Sep 14 21:02:14 2023 -0700 Commit: Mike Kaganski CommitDate: Fri Sep 15 07:28:13 2023 +0200 Move nUnicode variable to for loop condition statement. Use nUnicode directly in range based loop condition statement instead of declaring seperately in loop body. Change-Id: I07d8fb7a693909e0cf43ae0562547c51d001eb14 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156936 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 923bd84da756..19cdd2f3187a 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -214,9 +214,8 @@ void EscherPropertyContainer::AddOpt( std::vector aBuf; aBuf.reserve(rString.size() * 2 + 2); -for(const auto& nChar: rString) +for(const sal_Unicode nUnicode: rString) { -const sal_Unicode nUnicode(nChar); aBuf.push_back(static_cast(nUnicode)); aBuf.push_back(static_cast(nUnicode >> 8)); }
[Libreoffice-commits] core.git: filter/source
filter/source/msfilter/escherex.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 046cee10e62993238534c68e33d97ed63067b290 Author: Adam Seskunas AuthorDate: Thu Sep 7 09:39:11 2023 -0700 Commit: Ilmari Lauhakangas CommitDate: Thu Sep 14 16:47:29 2023 +0200 tdf#145538 Change traditional for loop to range based for loop Change-Id: I6c589c588a363cf09a1e6ae79a48911e23cbcf28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156676 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index c8115a3d3fb4..923bd84da756 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -214,9 +214,9 @@ void EscherPropertyContainer::AddOpt( std::vector aBuf; aBuf.reserve(rString.size() * 2 + 2); -for(size_t i(0); i < rString.size(); i++) +for(const auto& nChar: rString) { -const sal_Unicode nUnicode(rString[i]); +const sal_Unicode nUnicode(nChar); aBuf.push_back(static_cast(nUnicode)); aBuf.push_back(static_cast(nUnicode >> 8)); }
[Libreoffice-commits] core.git: formula/source framework/source
formula/source/ui/dlg/parawin.cxx|2 +- framework/source/fwe/classes/addonsoptions.cxx |2 +- framework/source/uielement/controlmenucontroller.cxx |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) New commits: commit b1b002c293ddf38be125dc9083f41eb27452c450 Author: Adam Seskunas AuthorDate: Thu Aug 31 14:14:03 2023 -0700 Commit: Hossein CommitDate: Mon Sep 4 15:50:51 2023 +0200 tdf#147021 use std::size instead of SAL_N_ELEMENTS Change-Id: Ibc6c83f950890ac9b7a754cc49973736fa81dcb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156364 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx index f09c0e51ec01..bcc1c2d1a962 100644 --- a/formula/source/ui/dlg/parawin.cxx +++ b/formula/source/ui/dlg/parawin.cxx @@ -496,7 +496,7 @@ IMPL_LINK( ParaWin, GetFxHdl, ArgInput&, rPtr, void ) { sal_uInt16 nOffset = GetSliderPos(); nEdFocus=NOT_FOUND; -for (size_t nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) +for (size_t nPos=0; nPos < std::size(aArgInput); ++nPos) { if( == [nPos]) { diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index d35b9a34c69e..cd384c737aa7 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -1594,7 +1594,7 @@ void AddonsOptions_Impl::ReadAndAssociateImages( const OUString& aURL, const OUS // Loop to create the two possible image names and try to read the bitmap files static const char* aExtArray[] = { "_16", "_26" }; -for ( size_t i = 0; i < SAL_N_ELEMENTS(aExtArray); i++ ) +for ( size_t i = 0; i < std::size(aExtArray); i++ ) { OUStringBuffer aFileURL( aImageURL ); aFileURL.appendAscii( aExtArray[i] ); diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index afbf3ec9258d..b6dd84e069ce 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -188,7 +188,7 @@ void ControlMenuController::updateImagesPopupMenu(Reference con { if (!rPopupMenu) return; -for (size_t i=0; i < SAL_N_ELEMENTS(aCommands); ++i) +for (size_t i=0; i < std::size(aCommands); ++i) { sal_Int16 nItemId = i + 1; if (m_bShowMenuImages)
[Libreoffice-commits] core.git: sw/source
sw/source/uibase/app/appenv.hxx|5 + sw/source/uibase/app/swdllimpl.hxx |5 + 2 files changed, 2 insertions(+), 8 deletions(-) New commits: commit 005f1547b8e5b37da243320b2eb7a84a47f4c821 Author: Adam Seskunas AuthorDate: Tue Aug 29 10:40:43 2023 -0700 Commit: Ilmari Lauhakangas CommitDate: Wed Aug 30 07:25:31 2023 +0200 tdf#143148 Use pragma once in uibase-app Change-Id: I95cf120f9aaf47bb4c588471a8cbdb4c0ceb6c99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156262 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas Reviewed-by: Ilmari Lauhakangas diff --git a/sw/source/uibase/app/appenv.hxx b/sw/source/uibase/app/appenv.hxx index 862e5b08f090..f077702bb93f 100644 --- a/sw/source/uibase/app/appenv.hxx +++ b/sw/source/uibase/app/appenv.hxx @@ -7,8 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_APP_APPENV_HXX -#define INCLUDED_SW_SOURCE_UIBASE_APP_APPENV_HXX +#pragma once #include @@ -17,6 +16,4 @@ class SwFieldMgr; OUString InsertLabEnvText(SwWrtShell&, SwFieldMgr&, const OUString&); -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/swdllimpl.hxx b/sw/source/uibase/app/swdllimpl.hxx index 0aea89bfa75b..7dab66d6ce6b 100644 --- a/sw/source/uibase/app/swdllimpl.hxx +++ b/sw/source/uibase/app/swdllimpl.hxx @@ -7,8 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_APP_SWDLLIMPL_HXX -#define INCLUDED_SW_SOURCE_UIBASE_APP_SWDLLIMPL_HXX +#pragma once #include @@ -43,6 +42,4 @@ private: SvxAutoCorrCfg* m_pAutoCorrCfg; }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Adam Seskunas license statement
All of my past & future contributions to LibreOffice may be licensed under the MPLv2/LGPLv3+ dual license.