Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test on Number related locale #9807

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
67 changes: 67 additions & 0 deletions framework/source/class/qx/test/locale/Number.js
@@ -0,0 +1,67 @@
/* ************************************************************************

qooxdoo - the new era of web development

http://qooxdoo.org

Copyright:
2007-2008 1&1 Internet AG, Germany, http://www.1und1.de

License:
MIT: https://opensource.org/licenses/MIT
See the LICENSE file in the project's top-level directory for details.

Authors:
* Romain Julian (rommni)

************************************************************************ */

qx.Class.define("qx.test.locale.Number", {
extend : qx.dev.unit.TestCase,

members: {
testNumberSeparators : function() {
// test not designed for generator build
if (!qx.core.Environment.get("qx.compilerVersion")) {
return;
}

var number = qx.locale.Number;
var useLocale = "C";

var commonGroupSeparator = ",";
var commonDecimalSeparator = ".";

this.assertEquals(commonGroupSeparator, number.getGroupSeparator(useLocale));
this.assertEquals(commonDecimalSeparator, number.getDecimalSeparator(useLocale));

useLocale = "fr";

var frenchLatinGroupSeparator = "\u202F"; // narrow no-break space
var frenchLatinDecimalSeparator = ",";

this.assertEquals(frenchLatinGroupSeparator, number.getGroupSeparator(useLocale));
this.assertEquals(frenchLatinDecimalSeparator, number.getDecimalSeparator(useLocale));
},

testPercentFormat : function() {
// test not designed for generator build
if (!qx.core.Environment.get("qx.compilerVersion")) {
return;
}

var number = qx.locale.Number;
var useLocale = "C";

var commonPercentFormat = "#,##0%";

this.assertEquals(commonPercentFormat, number.getPercentFormat(useLocale));

useLocale = "fr";

var frenchPercentFormat = "#,##0 %";

this.assertEquals(frenchPercentFormat, number.getPercentFormat(useLocale));
}
}
});