summaryrefslogtreecommitdiff
path: root/svl/qa
diff options
context:
space:
mode:
authorPhilipp Hofer <philipp.hofer@protonmail.com>2020-11-12 13:18:48 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2020-11-16 11:44:30 +0100
commit580b4c5f945df4e98bc2bacdf3620da688b2dbdf (patch)
tree4e428d83dad09dd13cb1c34ae6c74fbd8fa487e7 /svl/qa
parent69397a13d9458174ea3d0160cb65d77ac83c205c (diff)
tdf#123936 Formatting files in module svl with clang-format
Change-Id: Iaaac34428ef0e5b8f09f6cbcad16ea5bab145321 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105714 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'svl/qa')
-rw-r--r--svl/qa/unit/notify/test_SfxBroadcaster.cxx32
-rw-r--r--svl/qa/unit/test_lngmisc.cxx61
2 files changed, 43 insertions, 50 deletions
diff --git a/svl/qa/unit/notify/test_SfxBroadcaster.cxx b/svl/qa/unit/notify/test_SfxBroadcaster.cxx
index 79b6543ad681..ffed864ff631 100644
--- a/svl/qa/unit/notify/test_SfxBroadcaster.cxx
+++ b/svl/qa/unit/notify/test_SfxBroadcaster.cxx
@@ -36,30 +36,26 @@ class SfxBroadcasterTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
};
-namespace {
-
+namespace
+{
class MockedSfxListener : public SfxListener
{
public:
MockedSfxListener()
- : mNotifyWasCalled(false) {}
-
- void Notify(SfxBroadcaster&, const SfxHint&) override {
- mNotifyWasCalled = true;
+ : mNotifyWasCalled(false)
+ {
}
- bool NotifyWasCalled() const {
- return mNotifyWasCalled;
- }
+ void Notify(SfxBroadcaster&, const SfxHint&) override { mNotifyWasCalled = true; }
+
+ bool NotifyWasCalled() const { return mNotifyWasCalled; }
private:
bool mNotifyWasCalled;
};
-
}
-void
-SfxBroadcasterTest::AddingListenersIncreasesCount()
+void SfxBroadcasterTest::AddingListenersIncreasesCount()
{
SfxBroadcaster sb;
MockedSfxListener sl;
@@ -70,8 +66,7 @@ SfxBroadcasterTest::AddingListenersIncreasesCount()
CPPUNIT_ASSERT_EQUAL(size_t(1), sb.GetListenerCount());
}
-void
-SfxBroadcasterTest::RemovingListenersDecreasesCount()
+void SfxBroadcasterTest::RemovingListenersDecreasesCount()
{
SfxBroadcaster sb;
MockedSfxListener sl;
@@ -83,8 +78,7 @@ SfxBroadcasterTest::RemovingListenersDecreasesCount()
CPPUNIT_ASSERT_EQUAL(size_t(0), sb.GetListenerCount());
}
-void
-SfxBroadcasterTest::HintsAreNotForwardedToRemovedListeners()
+void SfxBroadcasterTest::HintsAreNotForwardedToRemovedListeners()
{
SfxBroadcaster sb;
MockedSfxListener sl1;
@@ -100,8 +94,7 @@ SfxBroadcasterTest::HintsAreNotForwardedToRemovedListeners()
CPPUNIT_ASSERT_EQUAL(false, sl1.NotifyWasCalled());
}
-void
-SfxBroadcasterTest::SameListenerCanBeAddedMoreThanOnce()
+void SfxBroadcasterTest::SameListenerCanBeAddedMoreThanOnce()
{
MockedSfxListener sl;
SfxBroadcaster sb;
@@ -110,8 +103,7 @@ SfxBroadcasterTest::SameListenerCanBeAddedMoreThanOnce()
CPPUNIT_ASSERT_EQUAL(size_t(2), sb.GetListenerCount());
}
-void
-SfxBroadcasterTest::StoppingListeningAffectsOnlyFirstOfIdenticalListeners()
+void SfxBroadcasterTest::StoppingListeningAffectsOnlyFirstOfIdenticalListeners()
{
MockedSfxListener sl;
SfxBroadcaster sb;
diff --git a/svl/qa/unit/test_lngmisc.cxx b/svl/qa/unit/test_lngmisc.cxx
index 9287c72365da..19efdd74a10c 100644
--- a/svl/qa/unit/test_lngmisc.cxx
+++ b/svl/qa/unit/test_lngmisc.cxx
@@ -22,9 +22,9 @@
namespace
{
- class LngMiscTest : public CppUnit::TestFixture
- {
- private:
+class LngMiscTest : public CppUnit::TestFixture
+{
+private:
void testRemoveHyphens();
void testRemoveControlChars();
void testReplaceControlChars();
@@ -38,14 +38,15 @@ namespace
CPPUNIT_TEST(testGetThesaurusReplaceText);
CPPUNIT_TEST_SUITE_END();
- };
+};
- void LngMiscTest::testRemoveHyphens()
- {
+void LngMiscTest::testRemoveHyphens()
+{
OUString str1("");
OUString str2("a-b--c---");
- OUString str3 = OUStringChar(SVT_SOFT_HYPHEN) + OUStringChar(SVT_HARD_HYPHEN) + OUStringChar(SVT_HARD_HYPHEN);
+ OUString str3 = OUStringChar(SVT_SOFT_HYPHEN) + OUStringChar(SVT_HARD_HYPHEN)
+ + OUStringChar(SVT_HARD_HYPHEN);
OUString str4("asdf");
@@ -56,7 +57,7 @@ namespace
// Note that '-' isn't a hyphen to RemoveHyphens.
bModified = linguistic::RemoveHyphens(str2);
CPPUNIT_ASSERT(!bModified);
- CPPUNIT_ASSERT_EQUAL( OUString("a-b--c---"), str2 );
+ CPPUNIT_ASSERT_EQUAL(OUString("a-b--c---"), str2);
bModified = linguistic::RemoveHyphens(str3);
CPPUNIT_ASSERT(bModified);
@@ -64,19 +65,19 @@ namespace
bModified = linguistic::RemoveHyphens(str4);
CPPUNIT_ASSERT(!bModified);
- CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str4 );
- }
+ CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str4);
+}
- void LngMiscTest::testRemoveControlChars()
- {
+void LngMiscTest::testRemoveControlChars()
+{
OUString str1("");
OUString str2("asdf");
OUString str3("asdf\nasdf");
OUStringBuffer str4Buf(33);
str4Buf.setLength(33);
- for(int i = 0; i < 33; i++)
- str4Buf[i] = static_cast<sal_Unicode>(i);
+ for (int i = 0; i < 33; i++)
+ str4Buf[i] = static_cast<sal_Unicode>(i);
// TODO: is this a bug? shouldn't RemoveControlChars remove this?
// str4Buf[33] = static_cast<sal_Unicode>(0x7F);
OUString str4(str4Buf.makeStringAndClear());
@@ -87,27 +88,27 @@ namespace
bModified = linguistic::RemoveControlChars(str2);
CPPUNIT_ASSERT(!bModified);
- CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str2 );
+ CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str2);
bModified = linguistic::RemoveControlChars(str3);
CPPUNIT_ASSERT(bModified);
- CPPUNIT_ASSERT_EQUAL( OUString("asdfasdf"), str3 );
+ CPPUNIT_ASSERT_EQUAL(OUString("asdfasdf"), str3);
bModified = linguistic::RemoveControlChars(str4);
CPPUNIT_ASSERT(bModified);
- CPPUNIT_ASSERT_EQUAL( OUString(" "), str4 );
- }
+ CPPUNIT_ASSERT_EQUAL(OUString(" "), str4);
+}
- void LngMiscTest::testReplaceControlChars()
- {
+void LngMiscTest::testReplaceControlChars()
+{
OUString str1("");
OUString str2("asdf");
OUString str3("asdf\nasdf");
OUStringBuffer str4Buf(33);
str4Buf.setLength(33);
- for(int i = 0; i < 33; i++)
- str4Buf[i] = static_cast<sal_Unicode>(i);
+ for (int i = 0; i < 33; i++)
+ str4Buf[i] = static_cast<sal_Unicode>(i);
// TODO: is this a bug? shouldn't RemoveControlChars remove this?
// str4Buf[33] = static_cast<sal_Unicode>(0x7F);
OUString str4(str4Buf.makeStringAndClear());
@@ -118,21 +119,21 @@ namespace
bModified = linguistic::ReplaceControlChars(str2);
CPPUNIT_ASSERT(!bModified);
- CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str2 );
+ CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str2);
bModified = linguistic::ReplaceControlChars(str3);
CPPUNIT_ASSERT(bModified);
- CPPUNIT_ASSERT_EQUAL(OUString("asdf asdf"), str3 );
+ CPPUNIT_ASSERT_EQUAL(OUString("asdf asdf"), str3);
bModified = linguistic::ReplaceControlChars(str4);
CPPUNIT_ASSERT(bModified);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(32), str4.getLength());
- for(int i = 0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
CPPUNIT_ASSERT_EQUAL(u' ', str4[i]);
- }
+}
- void LngMiscTest::testGetThesaurusReplaceText()
- {
+void LngMiscTest::testGetThesaurusReplaceText()
+{
const OUString str2("asdf");
OUString r = linguistic::GetThesaurusReplaceText("");
@@ -158,9 +159,9 @@ namespace
r = linguistic::GetThesaurusReplaceText(" * (abc) asdf *");
CPPUNIT_ASSERT(r.isEmpty());
- }
+}
- CPPUNIT_TEST_SUITE_REGISTRATION(LngMiscTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(LngMiscTest);
}
CPPUNIT_PLUGIN_IMPLEMENT();