diff options
author | Noel Grandin <noel@peralex.com> | 2015-07-13 16:17:00 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-08-03 06:37:16 +0000 |
commit | 2660d24a07866e083c5135ea263030f3e3a2e729 (patch) | |
tree | 0089d6018d4fc33a7fde955e585e77191cdd258b /editeng/qa | |
parent | baba1d14766282bd2c592bffd79ed69f9078cfe1 (diff) |
new loplugin: refcounting
This was a feature requested by mmeeks, as a result of
tdf#92611.
It validates that things that extend XInterface are not
directly heap/stack-allocated, but have their lifecycle managed
via css::uno::Reference or rtl::Reference.
Change-Id: I28e3b8b236f6a4a56d0a6d6f26ad54e44b36e692
Reviewed-on: https://gerrit.libreoffice.org/16924
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'editeng/qa')
-rw-r--r-- | editeng/qa/unit/core-test.cxx | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index efb82d83ad4e..8d5fcf7056c9 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -110,112 +110,112 @@ void Test::testUnoTextFields() { { // DATE - SvxUnoTextField aField(text::textfield::Type::DATE); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::DATE)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // URL - SvxUnoTextField aField(text::textfield::Type::URL); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::URL)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.URL"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PAGE - SvxUnoTextField aField(text::textfield::Type::PAGE); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PAGE)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.PageNumber"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PAGES - SvxUnoTextField aField(text::textfield::Type::PAGES); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PAGES)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.PageCount"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // TIME - SvxUnoTextField aField(text::textfield::Type::TIME); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::TIME)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // FILE - SvxUnoTextField aField(text::textfield::Type::DOCINFO_TITLE); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::DOCINFO_TITLE)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.docinfo.Title"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // TABLE - SvxUnoTextField aField(text::textfield::Type::TABLE); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::TABLE)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.SheetName"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // EXTENDED TIME - SvxUnoTextField aField(text::textfield::Type::EXTENDED_TIME); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_TIME)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // EXTENDED FILE - SvxUnoTextField aField(text::textfield::Type::EXTENDED_FILE); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_FILE)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.FileName"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // AUTHOR - SvxUnoTextField aField(text::textfield::Type::AUTHOR); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::AUTHOR)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.Author"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // MEASURE - SvxUnoTextField aField(text::textfield::Type::MEASURE); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::MEASURE)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.Measure"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PRESENTATION HEADER - SvxUnoTextField aField(text::textfield::Type::PRESENTATION_HEADER); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_HEADER)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.Header"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PRESENTATION FOOTER - SvxUnoTextField aField(text::textfield::Type::PRESENTATION_FOOTER); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_FOOTER)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.Footer"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PRESENTATION DATE TIME - SvxUnoTextField aField(text::textfield::Type::PRESENTATION_DATE_TIME); - uno::Sequence<OUString> aSvcs = aField.getSupportedServiceNames(); + uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_DATE_TIME)); + uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } |