示例#1
0
 def test_ABullet(self):
     self.assertEqual(len(doc.get_children('ABullet')), 6)
     element = doc.get_children('ABullet')[0]
     self.assertElement(element, 'ABullet',
         Self="dABullet0",
         CharacterType="UnicodeOnly",
         CharacterValue=8226
     )
     self.assertProps(element.Properties,
         BulletsFont='$ID/',
         BulletsFontStyle='$ID/'
     )
示例#2
0
 def test_Assignment(self):
     self.assertEqual(len(doc.get_children('Assignment')), 1)
     element = doc.get_children('Assignment')[0]
     self.assertElement(element, 'Assignment',
         Self="u94",
         Name="$ID/UnassignedInCopy",
         UserName="******", 
         ExportOptions="AssignedSpreads",
         IncludeLinksWhenPackage=True,
         FilePath="$ID/"
     )
     self.assertEqual(element.Properties.FrameColor, 'Nothing')
示例#3
0
    def test_get_closest(self):
        spread = doc.get_children('Spread')[1]
        page_item = spread.get_children('TextFrame')[0]

        self.assertEqual(page_item.get_closest('TextFrame'), page_item)
        self.assertEqual(page_item.get_closest('Spread'), spread)
        self.assertEqual(spread.get_closest('TextFrame'), None)
示例#4
0
    def test_get_closest(self):
        spread = doc.get_children('Spread')[1]
        page_item = spread.get_children('TextFrame')[0]

        self.assertEqual(page_item.get_closest('TextFrame'), page_item)
        self.assertEqual(page_item.get_closest('Spread'), spread)
        self.assertEqual(spread.get_closest('TextFrame'), None)
示例#5
0
 def test_get_relative_transformation_pasteboard(self):
     """
     Test get_relative_transformation() relative to the pasteboard
     """
     self.assertTrue(numpy.all(
         doc.get_relative_transformation() == 
         numpy.identity(3)
     ))
     spread = doc.get_children('Spread')[1]
     self.assertTrue(numpy.all(
         spread.get_relative_transformation() == 
         numpy.matrix([
             [1, 0, 0],
             [0, 1, 0],
             [0, 1200.472440944882, 1],
         ])
     ))
     page_item = spread.get_children('TextFrame')[0]
     self.assertTrue(numpy.all(
         page_item.get_relative_transformation() == 
         numpy.matrix([
             [1, 0, 0],
             [0, 1, 0],
             [401.10236220472433, 941.96692913385834, 1],
         ])
     ))
示例#6
0
 def test_NumberingList(self):
     element = doc.get_children('NumberingList')[0]
     self.assertElement(element, 'NumberingList',
         Self="NumberingList/$ID/[Default]",
         Name="$ID/[Default]",
         ContinueNumbersAcrossStories=False,
         ContinueNumbersAcrossDocuments=False
     )
示例#7
0
 def test_get_transformation(self):
     page_item = doc.get_children('Spread')[1].get_children('TextFrame')[0]
     self.assertTrue(
         numpy.all(page_item.get_transformation() == numpy.matrix([
             [1, 0, 0],
             [0, 1, 0],
             [401.10236220472433, -258.50551181102367, 1],
         ])))
示例#8
0
 def test_get_transformation(self):
     page_item = doc.get_children('Spread')[1].get_children('TextFrame')[0]
     self.assertTrue(numpy.all(
         page_item.get_transformation() ==
         numpy.matrix([
             [1, 0, 0],
             [0, 1, 0],
             [401.10236220472433, -258.50551181102367, 1],
         ])
     ))
示例#9
0
 def test_MasterSpread(self):
     element = doc.get_children('MasterSpread')[12]
     self.assertElement(element, 'MasterSpread',
         Self="u481",
         ItemTransform=[1, 0, 0, 1, 0, 0],
         Name="B-Travel",
         NamePrefix="B",
         BaseName="Travel",
         ShowMasterItems=True,
         PageCount=2,
         OverriddenPageItemProps=""
     )
示例#10
0
 def test_Layer(self):
     element = doc.get_children('Layer')[0]
     self.assertElement(element, 'Layer',
         Self="ua4",
         Name="Layer 1",
         Visible=True,
         Locked=False,
         IgnoreWrap=False,
         ShowGuides=True,
         LockGuides=False,
         UI=True,
         Expendable=True,
         Printable=True
     )
     self.assertEqual(element.Properties.LayerColor, 'LightBlue')
示例#11
0
 def test_get_relative_transformation_relative(self):
     """
     Test get_relative_transformation() relative to other elements
     """
     spread = doc.get_children('Spread')[1]
     page_item = spread.get_children('TextFrame')[0]
     self.assertTrue(
         numpy.all(
             page_item.get_relative_transformation(spread) == numpy.matrix([
                 [1, 0, 0],
                 [0, 1, 0],
                 [401.10236220472433, -258.50551181102367, 1],
             ])))
     self.assertTrue(
         numpy.all(
             page_item.get_relative_transformation(page_item) ==
             numpy.identity(3)))
示例#12
0
 def test_get_relative_transformation_relative(self):
     """
     Test get_relative_transformation() relative to other elements
     """
     spread = doc.get_children('Spread')[1]
     page_item = spread.get_children('TextFrame')[0]
     self.assertTrue(numpy.all(
         page_item.get_relative_transformation(spread) ==
         numpy.matrix([
             [1, 0, 0],
             [0, 1, 0],
             [401.10236220472433, -258.50551181102367, 1],
         ])
     ))
     self.assertTrue(numpy.all(
         page_item.get_relative_transformation(page_item) == numpy.identity(3)
     ))
示例#13
0
 def test_get_relative_transformation_pasteboard(self):
     """
     Test get_relative_transformation() relative to the pasteboard
     """
     self.assertTrue(
         numpy.all(doc.get_relative_transformation() == numpy.identity(3)))
     spread = doc.get_children('Spread')[1]
     self.assertTrue(
         numpy.all(spread.get_relative_transformation() == numpy.matrix([
             [1, 0, 0],
             [0, 1, 0],
             [0, 1200.472440944882, 1],
         ])))
     page_item = spread.get_children('TextFrame')[0]
     self.assertTrue(
         numpy.all(page_item.get_relative_transformation() == numpy.matrix([
             [1, 0, 0],
             [0, 1, 0],
             [401.10236220472433, 941.96692913385834, 1],
         ])))
示例#14
0
 def test_NamedGrid(self):
     element = doc.get_children('NamedGrid')[0]
     self.assertElement(element, 'NamedGrid',
         Self="NamedGrid/$ID/[Page Grid]",
         Name="$ID/[Page Grid]"
     )
     self.assertEqual(len(element.children), 1)
     
     self.assertElement(element.children[0], 'GridDataInformation',
         FontStyle="Regular",
         PointSize=12,
         CharacterAki=0,
         LineAki=9,
         HorizontalScale=100,
         VerticalScale=100,
         LineAlignment="LeftOrTopLineJustify",
         GridAlignment="AlignEmCenter",
         CharacterAlignment="AlignEmCenter"
     )
     self.assertProps(element.children[0].Properties,
         AppliedFont="Times New Roman"
     )
示例#15
0
 def test_MetadataPacketPreference(self):
     element = doc.get_children('MetadataPacketPreference')[0]
     self.assertElement(element, 'MetadataPacketPreference')
     self.assertTrue(element.Properties.Contents.startswith('<?xpacket'))
示例#16
0
 def test_ConditionalTextPreference(self):
     element = doc.get_children('ConditionalTextPreference')[0]
     self.assertElement(element, 'ConditionalTextPreference',
         ShowConditionIndicators="ShowIndicators",
         ActiveConditionSet="n"
     )
示例#17
0
 def test_get_element(self):
     self.assertEqual(
         doc.get_element('Language/$ID/English%3a UK').Self,
         doc.get_children('Language')[0].Self,
     )
示例#18
0
 def setUp(self):
     super(SpreadTest, self).setUp()
     self.spread = doc.get_children('Spread')[0]
示例#19
0
 def test_count(self):
     self.assertEqual(len(doc.get_children('Spread')), 5)
示例#20
0
 def test_get_element(self):
     self.assertEqual(
         doc.get_element('Language/$ID/English%3a UK').Self,
         doc.get_children('Language')[0].Self,
     )
示例#21
0
 def setUp(self):
     super(StoriesTest, self).setUp()
     self.story = doc.get_children('Story')[109]
示例#22
0
 def test_parent(self):
     element = doc.get_children('Layer')[0]
     self.assertEqual(element.Properties._parent.Self, element.Self)
示例#23
0
 def test_parent_through_listfield(self):
     element = doc.get_children('Layer')[0]
     self.assertEqual(element._parent, doc)
示例#24
0
 def test_parent(self):
     element = doc.get_children('Layer')[0]
     self.assertEqual(element.Properties._parent.Self, element.Self)
示例#25
0
 def test_parent_through_listfield(self):
     element = doc.get_children('Layer')[0]
     self.assertEqual(element._parent, doc)
示例#26
0
 def setUp(self):
     super(StoriesTest, self).setUp()
     self.story = doc.get_children("Story")[109]