Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1129)

Side by Side Diff: fpdfsdk/javascript/public_methods_embeddertest.cpp

Issue 1882043004: Remove implicit cast from CFX_WideString to (const wchar_t*) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: win error #2 Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/javascript/PublicMethods.cpp ('k') | fpdfsdk/javascript/util.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cmath> 5 #include <cmath>
6 6
7 #include "core/fxcrt/include/fx_string.h" 7 #include "core/fxcrt/include/fx_string.h"
8 #include "fpdfsdk/javascript/PublicMethods.h" 8 #include "fpdfsdk/javascript/PublicMethods.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/js_embedder_test.h" 10 #include "testing/js_embedder_test.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 v8::Isolate::Scope isolate_scope(isolate()); 106 v8::Isolate::Scope isolate_scope(isolate());
107 #ifdef PDF_ENABLE_XFA 107 #ifdef PDF_ENABLE_XFA
108 v8::Locker locker(isolate()); 108 v8::Locker locker(isolate());
109 #endif // PDF_ENABLE_XFA 109 #endif // PDF_ENABLE_XFA
110 v8::HandleScope handle_scope(isolate()); 110 v8::HandleScope handle_scope(isolate());
111 v8::Context::Scope context_scope(GetV8Context()); 111 v8::Context::Scope context_scope(GetV8Context());
112 CFX_WideString formatted_date; 112 CFX_WideString formatted_date;
113 113
114 // 1968-06-25 114 // 1968-06-25
115 formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"ddmmyy"); 115 formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"ddmmyy");
116 EXPECT_STREQ(L"250668", formatted_date); 116 EXPECT_STREQ(L"250668", formatted_date.c_str());
117 formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"yy/mm/dd"); 117 formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"yy/mm/dd");
118 EXPECT_STREQ(L"68/06/25", formatted_date); 118 EXPECT_STREQ(L"68/06/25", formatted_date.c_str());
119 119
120 // 1969-12-31 120 // 1969-12-31
121 formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"ddmmyy"); 121 formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"ddmmyy");
122 EXPECT_STREQ(L"311269", formatted_date); 122 EXPECT_STREQ(L"311269", formatted_date.c_str());
123 formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"yy!mmdd"); 123 formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"yy!mmdd");
124 EXPECT_STREQ(L"69!1231", formatted_date); 124 EXPECT_STREQ(L"69!1231", formatted_date.c_str());
125 125
126 // 1970-01-01 126 // 1970-01-01
127 formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"ddmmyy"); 127 formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"ddmmyy");
128 EXPECT_STREQ(L"010170", formatted_date); 128 EXPECT_STREQ(L"010170", formatted_date.c_str());
129 formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"mm-yyyy-dd"); 129 formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"mm-yyyy-dd");
130 EXPECT_STREQ(L"01-1970-01", formatted_date); 130 EXPECT_STREQ(L"01-1970-01", formatted_date.c_str());
131 131
132 // 1985-12-31 132 // 1985-12-31
133 formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"ddmmyy"); 133 formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"ddmmyy");
134 EXPECT_STREQ(L"311285", formatted_date); 134 EXPECT_STREQ(L"311285", formatted_date.c_str());
135 formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"yymmdd"); 135 formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"yymmdd");
136 EXPECT_STREQ(L"851231", formatted_date); 136 EXPECT_STREQ(L"851231", formatted_date.c_str());
137 137
138 // 1995-02-01 138 // 1995-02-01
139 formatted_date = CJS_PublicMethods::MakeFormatDate(791596800000.0, L"ddmmyy"); 139 formatted_date = CJS_PublicMethods::MakeFormatDate(791596800000.0, L"ddmmyy");
140 EXPECT_STREQ(L"010295", formatted_date); 140 EXPECT_STREQ(L"010295", formatted_date.c_str());
141 formatted_date = 141 formatted_date =
142 CJS_PublicMethods::MakeFormatDate(791596800000.0, L"yyyymmdd"); 142 CJS_PublicMethods::MakeFormatDate(791596800000.0, L"yyyymmdd");
143 EXPECT_STREQ(L"19950201", formatted_date); 143 EXPECT_STREQ(L"19950201", formatted_date.c_str());
144 144
145 // 2005-02-01 145 // 2005-02-01
146 formatted_date = 146 formatted_date =
147 CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"ddmmyy"); 147 CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"ddmmyy");
148 EXPECT_STREQ(L"010205", formatted_date); 148 EXPECT_STREQ(L"010205", formatted_date.c_str());
149 formatted_date = 149 formatted_date =
150 CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"yyyyddmm"); 150 CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"yyyyddmm");
151 EXPECT_STREQ(L"20050102", formatted_date); 151 EXPECT_STREQ(L"20050102", formatted_date.c_str());
152 152
153 // 2085-12-31 153 // 2085-12-31
154 formatted_date = 154 formatted_date =
155 CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"ddmmyy"); 155 CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"ddmmyy");
156 EXPECT_STREQ(L"311285", formatted_date); 156 EXPECT_STREQ(L"311285", formatted_date.c_str());
157 formatted_date = 157 formatted_date =
158 CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"yyyydd"); 158 CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"yyyydd");
159 EXPECT_STREQ(L"208531", formatted_date); 159 EXPECT_STREQ(L"208531", formatted_date.c_str());
160 160
161 // 2095-02-01 161 // 2095-02-01
162 formatted_date = 162 formatted_date =
163 CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"ddmmyy"); 163 CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"ddmmyy");
164 EXPECT_STREQ(L"010295", formatted_date); 164 EXPECT_STREQ(L"010295", formatted_date.c_str());
165 formatted_date = 165 formatted_date =
166 CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"mmddyyyy"); 166 CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"mmddyyyy");
167 EXPECT_STREQ(L"02012095", formatted_date); 167 EXPECT_STREQ(L"02012095", formatted_date.c_str());
168 } 168 }
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/PublicMethods.cpp ('k') | fpdfsdk/javascript/util.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698