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

Unified Diff: testing/resources/javascript/util_printd.in

Issue 1833053002: util.printd() replaces specified date with current date. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: h is wrong, not H. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/javascript/util.cpp ('k') | testing/resources/javascript/util_printd_expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/resources/javascript/util_printd.in
diff --git a/testing/resources/javascript/util_printd.in b/testing/resources/javascript/util_printd.in
new file mode 100644
index 0000000000000000000000000000000000000000..f098187cf07ffbe840dc3b0f997b7f300a1e78bf
--- /dev/null
+++ b/testing/resources/javascript/util_printd.in
@@ -0,0 +1,104 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+ /OpenAction 10 0 R
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /Count 1
+ /Kids [
+ 3 0 R
+ ]
+>>
+endobj
+% Page number 0.
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <</F1 15 0 R>>
+ >>
+ /Contents [21 0 R]
+ /MediaBox [0 0 612 792]
+>>
+% OpenAction action
+{{object 10 0}} <<
+ /Type /Action
+ /S /JavaScript
+ /JS 11 0 R
+>>
+endobj
+% JS program to exexute
+{{object 11 0}} <<
+>>
+stream
+function TestOneFormat(str, d) {
+ try {
+ app.alert(str + ": " + util.printd(str, d));
+ }
+ catch (e) {
+ app.alert(str + ": Caught error: " + e);
+ }
+}
+function TestOneXFAFormat(str, d, flag) {
+ try {
+ app.alert(str + ": " + util.printd(str, d, flag));
+ }
+ catch (e) {
+ app.alert(str + ": Caught error: " + e);
+ }
+}
+// July 4th, 2014 11:59:59 AM local time.
+var d1 = new Date(2014, 06, 04, 15, 59, 58);
+TestOneFormat("mm/dd/yyyy HH:MM:ss", d1);
+TestOneFormat(0, d1);
+TestOneFormat(1, d1);
+TestOneFormat(2, d1);
+TestOneFormat(3, d1);
+TestOneFormat("mmmm", d1);
+TestOneFormat("mmm", d1);
+TestOneFormat("mm", d1);
+TestOneFormat("m", d1);
+TestOneFormat("dddd", d1);
+TestOneFormat("ddd", d1);
+TestOneFormat("dd", d1);
+TestOneFormat("d", d1);
+TestOneFormat("yyyy", d1);
+TestOneFormat("yy", d1);
+TestOneFormat("HH", d1);
+TestOneFormat("H", d1);
+TestOneFormat("hh", d1);
+// "h" is inconsitent between platforms: " 3" vs. "3"
+TestOneFormat("MM", d1);
+TestOneFormat("M", d1);
+TestOneFormat("ss", d1);
+TestOneFormat("s", d1);
+// "tt" is inconsitent between platforms: "PM" vs, "pm" vs. "P"
+TestOneFormat("t", d1);
+TestOneFormat("abc.efg.i.kl.nopqr..uvwxyzABC.EFG.I.KL.NOPQR..UVWXYZ0123456780", d1);
+TestOneFormat("!@#$^&*()-_<>[];:~", d1);
+TestOneFormat("%z %d %%z %%d %%%z %%%d %%% hh:MM", d1);
+TestOneFormat("", d1);
+TestOneFormat("mm/dd/yyyy", d1);
+TestOneFormat("mm/dd/yyyy", new Date(1850, 0, 1));
+TestOneFormat("mm/dd/yyyy", new Date(2525, 11, 31));
+TestOneFormat("mm/dd/yyyy");
+TestOneFormat();
+TestOneFormat("mm/dd/yyyy", 42);
+TestOneFormat("mm/dd/yyyy", "clams");
+TestOneFormat("mm/dd/yyyy", {"clams": 3});
+TestOneFormat("mm/dd/yyyy", ["clams", 3]);
+TestOneFormat({"clams": 3}, d1);
+TestOneFormat(["clams", 3], d1);
+TestOneXFAFormat("mm", d1, false);
+TestOneXFAFormat("mm", d1, true);
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
« no previous file with comments | « fpdfsdk/javascript/util.cpp ('k') | testing/resources/javascript/util_printd_expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698