~holger-seelig/cobweb.js/trunk

« back to all changes in this revision

Viewing changes to src/lib/opentype.js/test/tables/ltag.js

  • Committer: Holger Seelig
  • Date: 2017-08-22 04:53:24 UTC
  • Revision ID: holger.seelig@yahoo.de-20170822045324-4of4xxgt79669gbt
Switched to npm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'use strict';
 
2
 
 
3
var assert = require('assert');
 
4
var mocha = require('mocha');
 
5
var describe = mocha.describe;
 
6
var it = mocha.it;
 
7
var testutil = require('../testutil.js');
 
8
var ltag = require('../../src/tables/ltag.js');
 
9
 
 
10
describe('tables/ltag.js', function() {
 
11
    var data =
 
12
        '00 00 00 01 00 00 00 00 00 00 00 04 00 1C 00 02 ' +
 
13
        '00 1E 00 07 00 1E 00 02 00 25 00 13 65 6E 7A 68 ' +
 
14
        '2D 48 61 6E 74 73 6C 2D 72 6F 7A 61 6A 2D 73 6F ' +
 
15
        '6C 62 61 2D 31 39 39 34';
 
16
    var tags = ['en', 'zh-Hant', 'zh', 'sl-rozaj-solba-1994'];
 
17
 
 
18
    it('can make a language tag table', function() {
 
19
        assert.deepEqual(data, testutil.hex(ltag.make(tags).encode()));
 
20
    });
 
21
 
 
22
    it('can parse a language tag table', function() {
 
23
        assert.deepEqual(tags, ltag.parse(testutil.unhex('DE AD BE EF ' + data), 4));
 
24
    });
 
25
});