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
ad3834b1
Kaydet (Commit)
ad3834b1
authored
Şub 16, 2018
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Unit test tdf#114833 do not officiously force Y-M-D if D-M-Y is applicable
Change-Id: I2c78a06169526b079fd1463df23b09bacb50588b
üst
914f0922
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
0 deletions
+111
-0
svl.cxx
svl/qa/unit/svl.cxx
+111
-0
No files found.
svl/qa/unit/svl.cxx
Dosyayı görüntüle @
ad3834b1
...
...
@@ -64,6 +64,7 @@ public:
void
testTdf103060
();
void
testDateInput
();
void
testIsNumberFormat
();
void
testIsNumberFormatSpecific
();
void
testUserDefinedNumberFormats
();
void
testNfEnglishKeywordsIntegrity
();
void
testStandardColorIntegrity
();
...
...
@@ -79,6 +80,7 @@ public:
CPPUNIT_TEST
(
testTdf103060
);
CPPUNIT_TEST
(
testDateInput
);
CPPUNIT_TEST
(
testIsNumberFormat
);
CPPUNIT_TEST
(
testIsNumberFormatSpecific
);
CPPUNIT_TEST
(
testUserDefinedNumberFormats
);
CPPUNIT_TEST
(
testNfEnglishKeywordsIntegrity
);
CPPUNIT_TEST
(
testStandardColorIntegrity
);
...
...
@@ -1166,6 +1168,115 @@ void Test::testIsNumberFormat()
}
}
namespace
{
struct
FormatInputOutput
{
const
char
*
mpInput
;
const
bool
mbNumber
;
const
char
*
mpOutput
;
};
}
static
void
checkSpecificNumberFormats
(
SvNumberFormatter
&
rFormatter
,
const
std
::
vector
<
FormatInputOutput
>&
rVec
,
const
char
*
pName
)
{
for
(
size_t
i
=
0
;
i
<
rVec
.
size
();
++
i
)
{
sal_uInt32
nIndex
=
0
;
double
fNumber
=
0
;
OUString
aString
(
OUString
::
createFromAscii
(
rVec
[
i
].
mpInput
));
const
bool
bIsNumber
=
rFormatter
.
IsNumberFormat
(
aString
,
nIndex
,
fNumber
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
OString
(
pName
)
+
" "
+
OString
::
number
(
i
)
+
(
rVec
[
i
].
mbNumber
?
" not recognized: "
:
" should not be recognized: "
)
+
OUStringToOString
(
aString
,
RTL_TEXTENCODING_UTF8
)).
getStr
(),
rVec
[
i
].
mbNumber
,
bIsNumber
);
if
(
bIsNumber
)
{
Color
*
pColor
;
rFormatter
.
GetOutputString
(
fNumber
,
nIndex
,
aString
,
&
pColor
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
OString
(
OString
(
pName
)
+
" "
+
OString
::
number
(
i
)
+
" mismatch"
).
getStr
(),
OUString
::
createFromAscii
(
rVec
[
i
].
mpOutput
),
aString
);
}
}
}
void
Test
::
testIsNumberFormatSpecific
()
{
{
// en-US uses M/D/Y format, test that a-b-c input with a<=31 and b<=12
// does not lead to a/b/c date output
SvNumberFormatter
aFormatter
(
m_xContext
,
LANGUAGE_ENGLISH_US
);
std
::
vector
<
FormatInputOutput
>
aIO
=
{
{
"5-12-14"
,
false
,
""
},
{
"32-12-14"
,
true
,
"1932-12-14"
}
};
checkSpecificNumberFormats
(
aFormatter
,
aIO
,
"[en-US] date"
);
}
{
// de-DE uses D.M.Y format, test that a-b-c input with a<=31 and b<=12
// does not lead to a.b.c date output
SvNumberFormatter
aFormatter
(
m_xContext
,
LANGUAGE_GERMAN
);
std
::
vector
<
FormatInputOutput
>
aIO
=
{
{
"5-12-14"
,
false
,
""
},
{
"32-12-14"
,
true
,
"1932-12-14"
}
};
checkSpecificNumberFormats
(
aFormatter
,
aIO
,
"[de-DE] date"
);
}
{
// nl-NL uses D-M-Y format, test that D-M-Y input leads to D-M-Y output
// and ISO Y-M-D input leads to Y-M-D output.
SvNumberFormatter
aFormatter
(
m_xContext
,
LANGUAGE_DUTCH
);
std
::
vector
<
FormatInputOutput
>
aIO
=
{
{
"22-11-1999"
,
true
,
"22-11-99"
},
// if default YY changes to YYYY adapt this
{
"1999-11-22"
,
true
,
"1999-11-22"
},
{
"1-2-11"
,
true
,
"01-02-11"
},
// if default YY changes to YYYY adapt this
{
"99-2-11"
,
true
,
"1999-02-11"
}
};
checkSpecificNumberFormats
(
aFormatter
,
aIO
,
"[nl-NL] date"
);
}
{
// en-ZA uses Y/M/D format, test that Y/M/D input leads to Y/M/D output
// and ISO Y-M-D input leads to Y-M-D output.
SvNumberFormatter
aFormatter
(
m_xContext
,
LANGUAGE_ENGLISH_SAFRICA
);
std
::
vector
<
FormatInputOutput
>
aIO
=
{
{
"1999/11/22"
,
true
,
"99/11/22"
},
// if default YY changes to YYYY adapt this
{
"1999-11-22"
,
true
,
"1999-11-22"
},
{
"11/2/1"
,
true
,
"11/02/01"
},
// if default YY changes to YYYY adapt this
{
"99-2-11"
,
true
,
"1999-02-11"
},
{
"22-2-11"
,
true
,
"2022-02-11"
}
};
checkSpecificNumberFormats
(
aFormatter
,
aIO
,
"[en-ZA] date"
);
}
{
// fr-FR uses D/M/Y format with additional D.M.Y and D-M-Y date
// acceptance patterns, test combinations.
SvNumberFormatter
aFormatter
(
m_xContext
,
LANGUAGE_FRENCH
);
std
::
vector
<
FormatInputOutput
>
aIO
=
{
{
"22/11/1999"
,
true
,
"22/11/99"
},
// if default YY changes to YYYY adapt this
{
"1999-11-22"
,
true
,
"1999-11-22"
},
{
"1/2/11"
,
true
,
"01/02/11"
},
// if default YY changes to YYYY adapt this
{
"99-2-11"
,
true
,
"1999-02-11"
},
{
"22-2-11"
,
true
,
"22/02/11"
},
// if default YY changes to YYYY adapt this
{
"22.2.11"
,
true
,
"22/02/11"
}
// if default YY changes to YYYY adapt this
};
checkSpecificNumberFormats
(
aFormatter
,
aIO
,
"[fr-FR] date"
);
}
}
void
Test
::
testUserDefinedNumberFormats
()
{
LanguageType
eLang
=
LANGUAGE_ENGLISH_US
;
...
...
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