1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * Test fixture for the MeasurementSystem.
8 * @extends {testing.Test}
10 function MeasurementSystemUnitTest() {
11 testing.Test.call(this);
14 MeasurementSystemUnitTest.prototype = {
15 __proto__: testing.Test.prototype,
18 '../../../../../ui/webui/resources/js/cr.js',
19 '../print_preview_utils.js',
20 'measurement_system.js'
24 TEST_F('MeasurementSystemUnitTest', 'parseNumberFormat', function() {
25 assertTrue(areArraysEqual(
27 print_preview.MeasurementSystem.parseNumberFormat('123.456,78')));
28 assertTrue(areArraysEqual(
30 print_preview.MeasurementSystem.parseNumberFormat('123.456.78')));
31 assertTrue(areArraysEqual(
33 print_preview.MeasurementSystem.parseNumberFormat('123,456.78')));
34 assertTrue(areArraysEqual(
36 print_preview.MeasurementSystem.parseNumberFormat('123,456,78')));
37 assertTrue(areArraysEqual(
39 print_preview.MeasurementSystem.parseNumberFormat('123 456,78')));
40 assertTrue(areArraysEqual(
42 print_preview.MeasurementSystem.parseNumberFormat('123 456.78')));
43 assertTrue(areArraysEqual(
45 print_preview.MeasurementSystem.parseNumberFormat('123 456 78')));
46 assertTrue(areArraysEqual(
48 print_preview.MeasurementSystem.parseNumberFormat('123')));
50 assertTrue(areArraysEqual(
52 print_preview.MeasurementSystem.parseNumberFormat('abcdef')));
53 assertTrue(areArraysEqual(
55 print_preview.MeasurementSystem.parseNumberFormat(null)));
56 assertTrue(areArraysEqual(
58 print_preview.MeasurementSystem.parseNumberFormat(undefined)));
59 assertTrue(areArraysEqual(
61 print_preview.MeasurementSystem.parseNumberFormat('')));
62 assertTrue(areArraysEqual(
64 print_preview.MeasurementSystem.parseNumberFormat('1')));
65 assertTrue(areArraysEqual(
67 print_preview.MeasurementSystem.parseNumberFormat('12')));