Ejemplo n.º 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/'
     )
Ejemplo n.º 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')
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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],
         ])
     ))
Ejemplo n.º 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
     )
Ejemplo n.º 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],
         ])))
Ejemplo n.º 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],
         ])
     ))
Ejemplo n.º 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=""
     )
Ejemplo n.º 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')
Ejemplo n.º 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)))
Ejemplo n.º 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)
     ))
Ejemplo n.º 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],
         ])))
Ejemplo n.º 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"
     )
Ejemplo n.º 15
0
 def test_MetadataPacketPreference(self):
     element = doc.get_children('MetadataPacketPreference')[0]
     self.assertElement(element, 'MetadataPacketPreference')
     self.assertTrue(element.Properties.Contents.startswith('<?xpacket'))
Ejemplo n.º 16
0
 def test_ConditionalTextPreference(self):
     element = doc.get_children('ConditionalTextPreference')[0]
     self.assertElement(element, 'ConditionalTextPreference',
         ShowConditionIndicators="ShowIndicators",
         ActiveConditionSet="n"
     )
Ejemplo 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,
     )
Ejemplo n.º 18
0
 def setUp(self):
     super(SpreadTest, self).setUp()
     self.spread = doc.get_children('Spread')[0]
Ejemplo n.º 19
0
 def test_count(self):
     self.assertEqual(len(doc.get_children('Spread')), 5)
Ejemplo n.º 20
0
 def test_get_element(self):
     self.assertEqual(
         doc.get_element('Language/$ID/English%3a UK').Self,
         doc.get_children('Language')[0].Self,
     )
Ejemplo n.º 21
0
 def setUp(self):
     super(StoriesTest, self).setUp()
     self.story = doc.get_children('Story')[109]
Ejemplo n.º 22
0
 def test_parent(self):
     element = doc.get_children('Layer')[0]
     self.assertEqual(element.Properties._parent.Self, element.Self)
Ejemplo n.º 23
0
 def test_parent_through_listfield(self):
     element = doc.get_children('Layer')[0]
     self.assertEqual(element._parent, doc)
Ejemplo n.º 24
0
 def test_parent(self):
     element = doc.get_children('Layer')[0]
     self.assertEqual(element.Properties._parent.Self, element.Self)
Ejemplo n.º 25
0
 def test_parent_through_listfield(self):
     element = doc.get_children('Layer')[0]
     self.assertEqual(element._parent, doc)
Ejemplo n.º 26
0
 def setUp(self):
     super(StoriesTest, self).setUp()
     self.story = doc.get_children("Story")[109]