'use strict';

describe('font_post', function() {
  var font2154 = decodeFontData('[encoded data, 5648 characters]');
  var font1282 = decodeFontData('[encoded data, 32908 characters]');
  describe('OS/2 table removal on bad post table values', function() {
    it('has invalid version number', function() {
      var output;
      waitsFor(function() { return output; }, 10000);
      var font = new Font("font", new Stream(font2154), {
        loadedName: 'font',
        type: 'TrueType',
        differences: [],
        baseEncoding: []
      });
      ttx(font.data, function(result) { output = result; });
      runs(function() {
        verifyTtxOutput(output);
        expect(/<OS_2>\s*<version value="3"\/>/.test(output)).toEqual(true);
      });
    });

    it('has invalid selection attributes presence', function() {
      var output;
      waitsFor(function() { return output; }, 10000);
      var font = new Font("font", new Stream(font1282), {
        loadedName: 'font',
        type: 'CIDFontType2',
        differences: []
      });
      ttx(font.data, function(result) { output = result; });
      runs(function() {
        verifyTtxOutput(output);
        expect(/<OS_2>\s*<version value="3"\/>/.test(output)).toEqual(true);
      });
    });
  });
});
