Esempio n. 1
0
 def test_write_custom_parameter(self):
     # Name without quotes
     self.assertWritesValue(
         classes.GSCustomParameter('myParam', 'myValue'),
         "{\nname = myParam;\nvalue = myValue;\n}")
     # Name with quotes
     self.assertWritesValue(
         classes.GSCustomParameter('my param', 'myValue'),
         "{\nname = \"my param\";\nvalue = myValue;\n}")
     # Value with quotes
     self.assertWritesValue(
         classes.GSCustomParameter('myParam', 'my value'),
         "{\nname = myParam;\nvalue = \"my value\";\n}")
     # Int param (ascender): should convert the value to string
     self.assertWritesValue(
         classes.GSCustomParameter('ascender', 12),
         "{\nname = ascender;\nvalue = 12;\n}")
     # Float param (postscriptBlueScale): should convert the value to string
     self.assertWritesValue(
         classes.GSCustomParameter('postscriptBlueScale', 0.125),
         "{\nname = postscriptBlueScale;\nvalue = 0.125;\n}")
     # Bool param (isFixedPitch): should convert the boolean value to 0/1
     self.assertWritesValue(
         classes.GSCustomParameter('isFixedPitch', True),
         "{\nname = isFixedPitch;\nvalue = 1;\n}")
     # Intlist param: should map list of int to list of strings
     self.assertWritesValue(
         classes.GSCustomParameter('fsType', [1, 2]),
         "{\nname = fsType;\nvalue = (\n1,\n2\n);\n}")
Esempio n. 2
0
 def test_write_custom_parameter(self):
     # Name without quotes
     self.assertWritesValue(
         classes.GSCustomParameter("myParam", "myValue"),
         "{\nname = myParam;\nvalue = myValue;\n}",
     )
     # Name with quotes
     self.assertWritesValue(
         classes.GSCustomParameter("my param", "myValue"),
         '{\nname = "my param";\nvalue = myValue;\n}',
     )
     # Value with quotes
     self.assertWritesValue(
         classes.GSCustomParameter("myParam", "my value"),
         '{\nname = myParam;\nvalue = "my value";\n}',
     )
     # Int param (ascender): should convert the value to string
     self.assertWritesValue(
         classes.GSCustomParameter("ascender", 12),
         "{\nname = ascender;\nvalue = 12;\n}",
     )
     # Float param (postscriptBlueScale): should convert the value to string
     self.assertWritesValue(
         classes.GSCustomParameter("postscriptBlueScale", 0.125),
         "{\nname = postscriptBlueScale;\nvalue = 0.125;\n}",
     )
     # Bool param (isFixedPitch): should convert the boolean value to 0/1
     self.assertWritesValue(
         classes.GSCustomParameter("isFixedPitch", True),
         "{\nname = isFixedPitch;\nvalue = 1;\n}",
     )
     # Intlist param: should map list of int to list of strings
     self.assertWritesValue(
         classes.GSCustomParameter("fsType", [1, 2]),
         "{\nname = fsType;\nvalue = (\n1,\n2\n);\n}",
     )