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