def testGetSubsection(self): section = RingSection("R-00", None, 100, 60) subsection = section.addSubsection("R-00A", None, 100) self.assertEqual(section.getSubsection("R-00B"), None) self.assertEqual(section.getSubsection("R-00A"), section.subsections[0]) self.assertEqual(subsection, section.getSubsection("R-00A"))
def testDrawZoom1Section(self): section = RingSection("name", "blue", 0, 90) section.drawSectionOnZoom1(ArcDrawingTools.describeArcAnticlockwise) node = self.svgFile.getZoom1Background() sectionNode = self.svgFile.getElementById("ringSection1colourfulCircle", node) self.assertEqual(sectionNode.attrib["d"], "M 14694.4893 4827.0225 A 2705.4143 2705.4143 0 0 0 11989.075 2121.6082") self.assertEqual(sectionNode.attrib["fill"], "white") self.assertEqual(sectionNode.attrib["stroke"], "blue")
def testDrawBigCaption(self): section = RingSection("R2-01", "yellow", 100, 45) section.drawSectionOnZoom1(ArcDrawingTools.describeArcAnticlockwise) zoomNode = self.svgFile.getZoom1Background() textNode = self.svgFile.getElementById("ringSection1bigCaption", zoomNode) self.assertEqual(textNode.attrib["style"], "font-size:200px;font-style:normal;")
def testDrawZoom1Section(self): section = RingSection("name", "blue", 0, 90) section.drawSectionOnZoom1(ArcDrawingTools.describeArcAnticlockwise) node = self.svgFile.getZoom1Background() sectionNode = self.svgFile.getElementById( "ringSection1colourfulCircle", node) self.assertEqual( sectionNode.attrib["d"], "M 14694.4893 4827.0225 A 2705.4143 2705.4143 0 0 0 11989.075 2121.6082" ) self.assertEqual(sectionNode.attrib["fill"], "white") self.assertEqual(sectionNode.attrib["stroke"], "blue")
def testHasSubsections(self): section = RingSection("R-01", None, 0, 45) self.assertEqual(section.hasSubsections(), False) sectionWithSubsections = RingSection("R-02", None, 45, 90) sectionWithSubsections.addSubsection("R-02A", None, 30) self.assertEqual(sectionWithSubsections.hasSubsections(), True)
def testComputeSubsectionStartAngle(self): section = RingSection("R1-01", None, 30, 40) self.assertEqual(section.computeSubsectionStartAngle(), 30) section.addSubsection("R1-01A", None, 15) self.assertEqual(section.computeSubsectionStartAngle(), 45)
def testDrawBigCaption(self): section = RingSection("R2-01", "yellow", 100,45) section.drawSectionOnZoom1(ArcDrawingTools.describeArcAnticlockwise) zoomNode = self.svgFile.getZoom1Background() textNode = self.svgFile.getElementById("ringSection1bigCaption", zoomNode) self.assertEqual(textNode.attrib["style"], "font-size:200px;font-style:normal;")
def testNewSection(self): section = RingSection("R1-01", "green", 15, 35) self.assertEqual(section.longName, "R1-01") self.assertEqual(section.shortName, "ringSection1") self.assertEqual(section.startAngle, 15) self.assertEqual(section.endAngle, 50)