summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/public_methods_embeddertest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-21 11:12:20 -0800
committerLei Zhang <thestig@chromium.org>2015-12-21 11:12:20 -0800
commit9559b7ad8b897abefca605098b424c9351622226 (patch)
tree42ba385740c27604a1321b8192a78cf0a2b2896f /fpdfsdk/src/javascript/public_methods_embeddertest.cpp
parent1ac47ebfc2d106e25c3e13062cae2132daa49348 (diff)
downloadpdfium-9559b7ad8b897abefca605098b424c9351622226.tar.xz
Merge to XFA: Cleanup CJS_PublicMethods:
- Use FXSYS_iswdigit() instead of CJS_PublicMethods::IsDigit(). - Ditto for FXSYS_iswalpha() and FXSYS_iswalnum(). - Change CJS_PublicMethods::ParseNormalDate() and CJS_PublicMethods::MakeRegularDate() to take an out parameter by ptr. TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1539113002 . (cherry picked from commit f84fd2b1dac1fcca41db84d162995c38af650614) Review URL: https://codereview.chromium.org/1542693002 .
Diffstat (limited to 'fpdfsdk/src/javascript/public_methods_embeddertest.cpp')
-rw-r--r--fpdfsdk/src/javascript/public_methods_embeddertest.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/fpdfsdk/src/javascript/public_methods_embeddertest.cpp b/fpdfsdk/src/javascript/public_methods_embeddertest.cpp
index eac5264c6a..c61215aa29 100644
--- a/fpdfsdk/src/javascript/public_methods_embeddertest.cpp
+++ b/fpdfsdk/src/javascript/public_methods_embeddertest.cpp
@@ -26,13 +26,13 @@ TEST_F(PublicMethodsEmbedderTest, MakeRegularDate) {
#endif // PDF_ENABLE_XFA
v8::HandleScope handle_scope(isolate());
v8::Context::Scope context_scope(GetV8Context());
- FX_BOOL bWrongFormat;
+ bool bWrongFormat;
double date;
// 1968
bWrongFormat = false;
date = CJS_PublicMethods::MakeRegularDate(L"06/25/1968", L"mm/dd/yyyy",
- bWrongFormat);
+ &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(-47865600000, date);
EXPECT_FALSE(bWrongFormat);
@@ -40,7 +40,7 @@ TEST_F(PublicMethodsEmbedderTest, MakeRegularDate) {
// 1968
bWrongFormat = false;
date = CJS_PublicMethods::MakeRegularDate(L"25061968", L"ddmmyyyy",
- bWrongFormat);
+ &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(-47865600000, date);
EXPECT_FALSE(bWrongFormat);
@@ -48,7 +48,7 @@ TEST_F(PublicMethodsEmbedderTest, MakeRegularDate) {
// 1968
bWrongFormat = false;
date = CJS_PublicMethods::MakeRegularDate(L"19680625", L"yyyymmdd",
- bWrongFormat);
+ &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(-47865600000, date);
EXPECT_FALSE(bWrongFormat);
@@ -56,14 +56,15 @@ TEST_F(PublicMethodsEmbedderTest, MakeRegularDate) {
// 1985
bWrongFormat = false;
date = CJS_PublicMethods::MakeRegularDate(L"31121985", L"ddmmyyyy",
- bWrongFormat);
+ &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(504835200000.0, date);
EXPECT_FALSE(bWrongFormat);
// 2085, the other '85.
bWrongFormat = false;
- date = CJS_PublicMethods::MakeRegularDate(L"311285", L"ddmmyy", bWrongFormat);
+ date =
+ CJS_PublicMethods::MakeRegularDate(L"311285", L"ddmmyy", &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(3660595200000.0, date);
EXPECT_FALSE(bWrongFormat);
@@ -71,14 +72,15 @@ TEST_F(PublicMethodsEmbedderTest, MakeRegularDate) {
// 1995
bWrongFormat = false;
date = CJS_PublicMethods::MakeRegularDate(L"01021995", L"ddmmyyyy",
- bWrongFormat);
+ &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(791596800000.0, date);
EXPECT_FALSE(bWrongFormat);
// 2095, the other '95.
bWrongFormat = false;
- date = CJS_PublicMethods::MakeRegularDate(L"010295", L"ddmmyy", bWrongFormat);
+ date =
+ CJS_PublicMethods::MakeRegularDate(L"010295", L"ddmmyy", &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(3947356800000.0, date);
EXPECT_FALSE(bWrongFormat);
@@ -86,14 +88,15 @@ TEST_F(PublicMethodsEmbedderTest, MakeRegularDate) {
// 2005
bWrongFormat = false;
date = CJS_PublicMethods::MakeRegularDate(L"01022005", L"ddmmyyyy",
- bWrongFormat);
+ &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(1107216000000.0, date);
EXPECT_FALSE(bWrongFormat);
// 2005
bWrongFormat = false;
- date = CJS_PublicMethods::MakeRegularDate(L"010205", L"ddmmyy", bWrongFormat);
+ date =
+ CJS_PublicMethods::MakeRegularDate(L"010205", L"ddmmyy", &bWrongFormat);
date = RoundDownDate(date);
EXPECT_DOUBLE_EQ(1107216000000.0, date);
EXPECT_FALSE(bWrongFormat);