예제 #1
0
 def test_get_options_addSVGtable_store_false_opts(self):
     args = XTRA_ARGS + ['-m', '-k', self.font_path]
     opts = addSVGtable.get_options(args)
     attr = ('make_font_copy', 'strip_viewbox', 'generate_woffs',
             'compress_svgs')
     result = list(set([getattr(opts, name) for name in attr]))[0]
     self.assertFalse(result)
예제 #2
0
 def test_get_options_addSVGtable_opts_defaults(self):
     dflt = {
         'make_font_copy': True,
         'strip_viewbox': True,
         'generate_woffs': False,
         'gnames_to_exclude': [],
         'compress_svgs': False
     }
     args = XTRA_ARGS + [self.font_path]
     opts = addSVGtable.get_options(args)
     for key, val in dflt.items():
         self.assertEqual(getattr(opts, key), val)
예제 #3
0
 def test_get_options_addSVGtable_brotli_missing(self):
     with self.assertRaises(SystemExit) as cm:
         addSVGtable.get_options(XTRA_ARGS + ['-w', self.font_path])
     self.assertEqual(cm.exception.code, 1)
예제 #4
0
 def test_get_options_invalid_folder_path(self):
     with self.assertRaises(SystemExit) as cm:
         addSVGtable.get_options(['-s', 'xfolder', 'xfont'])
     self.assertEqual(cm.exception.code, 1)
예제 #5
0
 def test_get_options_required_option(self):
     # -s option is required for addSVGtable
     with self.assertRaises(SystemExit) as cm:
         addSVGtable.get_options(['xfont'])
     self.assertEqual(cm.exception.code, 2)
예제 #6
0
 def test_get_options_addSVGtable_multiple_fonts(self):
     args = XTRA_ARGS + [self.font_path, self.font_path]
     with self.assertRaises(SystemExit) as cm:
         addSVGtable.get_options(args)
     self.assertEqual(cm.exception.code, 2)