From 2660d24a07866e083c5135ea263030f3e3a2e729 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 13 Jul 2015 16:17:00 +0200 Subject: 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 Tested-by: Noel Grandin --- editeng/qa/unit/core-test.cxx | 56 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'editeng/qa') 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::DATE)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::URL)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PAGE)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PAGES)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::TIME)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::DOCINFO_TITLE)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::TABLE)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_TIME)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_FILE)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::AUTHOR)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::MEASURE)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_HEADER)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_FOOTER)); + uno::Sequence 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 aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_DATE_TIME)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } -- cgit