| 1 |
// Copyright 2008 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
goog.provide('goog.locale.genericFontNamesTest'); |
| 16 |
goog.setTestOnly('goog.locale.genericFontNamesTest'); |
| 17 |
|
| 18 |
goog.require('goog.locale.genericFontNames'); |
| 19 |
goog.require('goog.testing.jsunit'); |
| 20 |
|
| 21 |
goog.locale.genericFontNames.data_['zh_TW'] = [ |
| 22 |
{ |
| 23 |
'caption': '\u5fae\u8edf\u6b63\u9ed1\u9ad4', |
| 24 |
'value': 'Microsoft JhengHei,\u5fae\u8edf\u6b63\u9ed1\u9ad4,SimHei,' + |
| 25 |
'\u9ed1\u4f53,MS Hei,STHeiti,\u534e\u6587\u9ed1\u4f53,Apple ' + |
| 26 |
'LiGothic Medium,\u860b\u679c\u5137\u4e2d\u9ed1,LiHei Pro Medium,' + |
| 27 |
'\u5137\u9ed1 Pro,STHeiti Light,\u534e\u6587\u7ec6\u9ed1,AR PL ' + |
| 28 |
'ZenKai Uni,\u6587\u9f0ePL\u4e2d\u6977Uni,FreeSans,sans-serif' |
| 29 |
}, |
| 30 |
{ |
| 31 |
'caption': '\u5fae\u8f6f\u96c5\u9ed1\u5b57\u4f53', |
| 32 |
'value': 'Microsoft YaHei,\u5fae\u8f6f\u96c5\u9ed1\u5b57\u4f53,FreeSans,' + |
| 33 |
'sans-serif' |
| 34 |
}, |
| 35 |
{ |
| 36 |
'caption': '\u65b0\u7d30\u660e\u9ad4', |
| 37 |
'value': 'SimSun,\u5b8b\u4f53,MS Song,STSong,\u534e\u6587\u5b8b\u4f53,' + |
| 38 |
'Apple LiSung Light,\u860b\u679c\u5137\u7d30\u5b8b,LiSong Pro Light,' + |
| 39 |
'\u5137\u5b8b Pro,STFangSong,\u534e\u6587\u4eff\u5b8b,AR PL ' + |
| 40 |
'ShanHeiSun Uni,\u6587\u9f0eP' + |
| 41 |
'L\u7ec6\u4e0a\u6d77\u5b8bUni,AR PL New Sung,\u6587\u9f0e PL \u65b0' + |
| 42 |
'\u5b8b,FreeSerif,serif' |
| 43 |
}, |
| 44 |
{ |
| 45 |
'caption': '\u7d30\u660e\u9ad4', |
| 46 |
'value': 'NSimsun,\u65b0\u5b8b\u4f53,FreeMono,monospace' |
| 47 |
} |
| 48 |
]; |
| 49 |
|
| 50 |
function testNormalize() { |
| 51 |
var result = goog.locale.genericFontNames.normalize_('zh'); |
| 52 |
assertEquals('zh', result); |
| 53 |
var result = goog.locale.genericFontNames.normalize_('zh-hant'); |
| 54 |
assertEquals('zh_Hant', result); |
| 55 |
var result = goog.locale.genericFontNames.normalize_('zh-hant-tw'); |
| 56 |
assertEquals('zh_Hant_TW', result); |
| 57 |
} |
| 58 |
|
| 59 |
function testInvalid() { |
| 60 |
var result = goog.locale.genericFontNames.getList('invalid'); |
| 61 |
assertArrayEquals([], result); |
| 62 |
} |
| 63 |
|
| 64 |
function testZhHant() { |
| 65 |
var result = goog.locale.genericFontNames.getList('zh-tw'); |
| 66 |
assertObjectEquals( |
| 67 |
[ |
| 68 |
{ |
| 69 |
'caption': '\u5fae\u8edf\u6b63\u9ed1\u9ad4', |
| 70 |
'value': 'Microsoft JhengHei,\u5fae\u8edf\u6b63\u9ed1\u9ad4,SimHei,' + |
| 71 |
'\u9ed1\u4f53,MS Hei,STHeiti,\u534e\u6587\u9ed1\u4f53,Apple ' + |
| 72 |
'LiGothic Medium,\u860b\u679c\u5137\u4e2d\u9ed1,LiHei Pro Medium,' + |
| 73 |
'\u5137\u9ed1 Pro,STHeiti Light,\u534e\u6587\u7ec6\u9ed1,AR PL ' + |
| 74 |
'ZenKai Uni,\u6587\u9f0ePL\u4e2d\u6977Uni,FreeSans,sans-serif' |
| 75 |
}, |
| 76 |
{ |
| 77 |
'caption': '\u5fae\u8f6f\u96c5\u9ed1\u5b57\u4f53', |
| 78 |
'value': 'Microsoft YaHei,\u5fae\u8f6f\u96c5\u9ed1\u5b57\u4f53,' + |
| 79 |
'FreeSans,sans-serif' |
| 80 |
}, |
| 81 |
{ |
| 82 |
'caption': '\u65b0\u7d30\u660e\u9ad4', |
| 83 |
'value': |
| 84 |
'SimSun,\u5b8b\u4f53,MS Song,STSong,\u534e\u6587\u5b8b\u4f53,' + |
| 85 |
'Apple LiSung Light,\u860b\u679c\u5137\u7d30\u5b8b,LiSong Pro ' + |
| 86 |
'Light,\u5137\u5b8b Pro,STFangSong,\u534e\u6587\u4eff\u5b8b,AR PL ' + |
| 87 |
'ShanHeiSun Uni,\u6587\u9f0ePL\u7ec6\u4e0a\u6d77\u5b8bUni,AR PL New' + |
| 88 |
' Sung,\u6587\u9f0e PL \u65b0\u5b8b,FreeSerif,serif' |
| 89 |
}, |
| 90 |
{ |
| 91 |
'caption': '\u7d30\u660e\u9ad4', |
| 92 |
'value': 'NSimsun,\u65b0\u5b8b\u4f53,FreeMono,monospace' |
| 93 |
} |
| 94 |
], |
| 95 |
result); |
| 96 |
} |