Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
091ba739
Kaydet (Commit)
091ba739
authored
Kas 26, 2011
tarafından
August Sodora
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added test for linguistic::RemoveHyphen and some simplification
üst
e81f36f6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
8 deletions
+130
-8
CppunitTest_svl_lngmisc.mk
svl/CppunitTest_svl_lngmisc.mk
+37
-0
Module_svl.mk
svl/Module_svl.mk
+4
-0
lngmisc.hxx
svl/inc/svl/lngmisc.hxx
+2
-0
test_lngmisc.cxx
svl/qa/unit/test_lngmisc.cxx
+83
-0
lngmisc.cxx
svl/source/misc/lngmisc.cxx
+4
-8
No files found.
svl/CppunitTest_svl_lngmisc.mk
0 → 100644
Dosyayı görüntüle @
091ba739
$(eval $(call gb_CppunitTest_CppunitTest,svl_lngmisc))
$(eval $(call gb_CppunitTest_add_exception_objects,svl_lngmisc, \
svl/qa/unit/test_lngmisc \
))
# add a list of all needed libraries here
$(eval $(call gb_CppunitTest_add_linked_libs,svl_lngmisc, \
comphelper \
cppu \
cppuhelper \
sal \
salhelper \
sb \
sot \
svl \
svt \
tl \
utl \
vcl \
xcr \
$(gb_STDLIBS) \
))
ifeq ($(GUI),WNT)
$(eval $(call gb_CppunitTest_add_linked_libs,svl_lngmisc, \
oleaut32 \
))
endif
$(eval $(call gb_CppunitTest_set_include,svl_lngmisc,\
-I$(realpath $(SRCDIR)/svl/source/inc) \
-I$(realpath $(SRCDIR)/svl/inc) \
$$(INCLUDE) \
-I$(OUTDIR)/inc \
))
\ No newline at end of file
svl/Module_svl.mk
Dosyayı görüntüle @
091ba739
...
...
@@ -36,6 +36,10 @@ $(eval $(call gb_Module_add_targets,svl,\
Package_inc \
))
$(eval $(call gb_Module_add_check_targets,svl,\
CppunitTest_svl_lngmisc \
))
$(eval $(call gb_Module_add_subsequentcheck_targets,svl,\
JunitTest_svl_complex \
))
...
...
svl/inc/svl/lngmisc.hxx
Dosyayı görüntüle @
091ba739
...
...
@@ -31,6 +31,8 @@
#include "svl/svldllapi.h"
#include <rtl/ustring.hxx>
class
String
;
///////////////////////////////////////////////////////////////////////////
...
...
svl/qa/unit/test_lngmisc.cxx
0 → 100644
Dosyayı görüntüle @
091ba739
#include "sal/config.h"
#include "sal/precppunit.hxx"
#include "cppunit/TestAssert.h"
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
#include "svl/lngmisc.hxx"
#include <rtl/ustrbuf.hxx>
namespace
{
class
LngMiscTest
:
public
CppUnit
::
TestFixture
{
private
:
void
testRemoveHyphens
();
// void testRemoveControlChars();
// void testReplaceControlChars();
// void testGetThesaurusReplaceText();
CPPUNIT_TEST_SUITE
(
LngMiscTest
);
CPPUNIT_TEST
(
testRemoveHyphens
);
// CPPUNIT_TEST(testRemoveControlChars);
// CPPUNIT_TEST(testReplaceControlChars);
// CPPUNIT_TEST(testGetThesaurusReplaceText);
CPPUNIT_TEST_SUITE_END
();
};
void
LngMiscTest
::
testRemoveHyphens
()
{
::
rtl
::
OUString
str1
(
RTL_CONSTASCII_USTRINGPARAM
(
""
));
::
rtl
::
OUString
str2
(
RTL_CONSTASCII_USTRINGPARAM
(
"a-b--c---"
));
::
rtl
::
OUStringBuffer
str3Buf
;
str3Buf
.
append
(
SVT_SOFT_HYPHEN
);
str3Buf
.
append
(
SVT_HARD_HYPHEN
);
str3Buf
.
append
(
SVT_HARD_HYPHEN
);
::
rtl
::
OUString
str3
(
str3Buf
.
makeStringAndClear
());
::
rtl
::
OUString
str4
(
RTL_CONSTASCII_USTRINGPARAM
(
"asdf"
));
bool
bModified
=
linguistic
::
RemoveHyphens
(
str1
);
CPPUNIT_ASSERT
(
!
bModified
);
CPPUNIT_ASSERT
(
str1
.
isEmpty
());
// Note that '-' isn't a hyphen to RemoveHyphens.
bModified
=
linguistic
::
RemoveHyphens
(
str2
);
CPPUNIT_ASSERT
(
!
bModified
);
CPPUNIT_ASSERT
(
str2
.
equalsAsciiL
(
RTL_CONSTASCII_STRINGPARAM
(
"a-b--c---"
)));
bModified
=
linguistic
::
RemoveHyphens
(
str3
);
CPPUNIT_ASSERT
(
bModified
);
CPPUNIT_ASSERT
(
str3
.
isEmpty
());
bModified
=
linguistic
::
RemoveHyphens
(
str4
);
CPPUNIT_ASSERT
(
!
bModified
);
CPPUNIT_ASSERT
(
str4
.
equalsAsciiL
(
RTL_CONSTASCII_STRINGPARAM
(
"asdf"
)));
}
/*
void LngMiscTest::testRemoveControlChars()
{
CPPUNIT_ASSERT(true);
}
void LngMiscTest::testReplaceControlChars()
{
CPPUNIT_ASSERT(true);
}
void LngMiscTest::testGetThesaurusReplaceText()
{
CPPUNIT_ASSERT(true);
}
*/
CPPUNIT_TEST_SUITE_REGISTRATION
(
LngMiscTest
);
}
CPPUNIT_PLUGIN_IMPLEMENT
();
svl/source/misc/lngmisc.cxx
Dosyayı görüntüle @
091ba739
...
...
@@ -58,14 +58,10 @@ sal_Int32 GetNumControlChars( const OUString &rTxt )
sal_Bool
RemoveHyphens
(
OUString
&
rTxt
)
{
sal_Bool
bModified
=
sal_False
;
if
(
HasHyphens
(
rTxt
))
{
rTxt
=
comphelper
::
string
::
remove
(
rTxt
,
SVT_SOFT_HYPHEN
);
rTxt
=
comphelper
::
string
::
remove
(
rTxt
,
SVT_HARD_HYPHEN
);
bModified
=
sal_True
;
}
return
bModified
;
sal_Int32
n
=
rTxt
.
getLength
();
rTxt
=
comphelper
::
string
::
remove
(
rTxt
,
SVT_SOFT_HYPHEN
);
rTxt
=
comphelper
::
string
::
remove
(
rTxt
,
SVT_HARD_HYPHEN
);
return
n
!=
rTxt
.
getLength
();
}
sal_Bool
RemoveControlChars
(
OUString
&
rTxt
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment