intl/locale/tests/unit/test_bug374040.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 function test_full() {
michael@0 2 var date = new Date();
michael@0 3 var scriptableDateServ =
michael@0 4 Components.classes["@mozilla.org/intl/scriptabledateformat;1"].createInstance(Components.interfaces.nsIScriptableDateFormat);
michael@0 5
michael@0 6 var dateStrXpcom = scriptableDateServ.FormatDateTime("",
michael@0 7 scriptableDateServ.dateFormatLong, scriptableDateServ.timeFormatSeconds,
michael@0 8 date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(),
michael@0 9 date.getMinutes(), date.getSeconds());
michael@0 10
michael@0 11 var dateStrJs = date.toLocaleString();
michael@0 12
michael@0 13 do_check_eq(dateStrXpcom, dateStrJs);
michael@0 14
michael@0 15 }
michael@0 16
michael@0 17 function test_kTimeFormatSeconds() {
michael@0 18 var date = new Date();
michael@0 19 var scriptableDateServ =
michael@0 20 Components.classes["@mozilla.org/intl/scriptabledateformat;1"].createInstance(Components.interfaces.nsIScriptableDateFormat);
michael@0 21
michael@0 22 var dateStrXpcom = scriptableDateServ.FormatDateTime("",
michael@0 23 scriptableDateServ.dateFormatLong, scriptableDateServ.timeFormatNone,
michael@0 24 date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(),
michael@0 25 date.getMinutes(), date.getSeconds());
michael@0 26
michael@0 27 var dateStrJs = date.toLocaleDateString()
michael@0 28
michael@0 29 do_check_eq(dateStrXpcom, dateStrJs);
michael@0 30
michael@0 31 }
michael@0 32
michael@0 33 function run_test()
michael@0 34 {
michael@0 35 // XXX test disabled due to bug 421790
michael@0 36 return;
michael@0 37 test_full();
michael@0 38 test_kTimeFormatSeconds();
michael@0 39 }

mercurial