def testUpdateZoom2(self):
        svgTree = etree.parse(self.blankSVGpath)
        svgRoot = svgTree.getroot()
        svgFile = svg.SVG()
        svgFile.setSvg(svgRoot)

        zoom2 = svgFile.getZoom2Background()
        zoom2Old = etree.tostring(zoom2)

        section = LinacSection(self.name, self.colour, self.coord, self.width)
        self.assertEqual(etree.tostring(zoom2), zoom2Old)
        section.updateSvg()
        self.assertNotEqual(etree.tostring(zoom2), zoom2Old)
Exemple #2
0
    def testUpdateZoom2(self):
        svgTree = etree.parse(self.blankSVGpath)
        svgRoot = svgTree.getroot()
        svgFile = svg.SVG()
        svgFile.setSvg(svgRoot)

        zoom2 = svgFile.getZoom2Background()
        zoom2Old = etree.tostring(zoom2)

        section = LinacSection(self.name, self.colour, self.coord, self.width)
        self.assertEqual(etree.tostring(zoom2), zoom2Old)
        section.updateSvg()
        self.assertNotEqual(etree.tostring(zoom2), zoom2Old)
    def testDisplayedName(self):
        cSection = LinacSection("C", "green", 640)
        cSection.setDisplayedName("ABCDEFGH")
        cSection.updateSvg()

        zoomNode = self.svgFile.getZoom2Background()
        smallCaptionNode = self.svgFile.getElementById("section3SmallCaption", zoomNode)
        smallCaption = self.svgFile.getElementById("section3SmallCaptionTextPath", smallCaptionNode)
        self.assertEqual(smallCaption.text, "ABCDEFGH")

        zoomNode = self.svgFile.getZoom1Background()
        bigCaptionNode = self.svgFile.getElementById("section3BigCaption", zoomNode)
        bigCaption = self.svgFile.getElementById("section3BigCaptionTextPath", bigCaptionNode)
        self.assertEqual(bigCaption.text, "ABCDEFGH")
Exemple #4
0
    def testDisplayedName(self):
        cSection = LinacSection("C", "green", 640)
        cSection.setDisplayedName("ABCDEFGH")
        cSection.updateSvg()

        zoomNode = self.svgFile.getZoom2Background()
        smallCaptionNode = self.svgFile.getElementById("section3SmallCaption", zoomNode)
        smallCaption = self.svgFile.getElementById("section3SmallCaptionTextPath", smallCaptionNode)
        self.assertEqual(smallCaption.text, "ABCDEFGH")

        zoomNode = self.svgFile.getZoom1Background()
        bigCaptionNode = self.svgFile.getElementById("section3BigCaption", zoomNode)
        bigCaption = self.svgFile.getElementById("section3BigCaptionTextPath", bigCaptionNode)
        self.assertEqual(bigCaption.text, "ABCDEFGH")
class TestSectionElements(unittest.TestCase):
    def setUp(self):
        blankSVGpath = "./blank.svg"
        svgTree = etree.parse(blankSVGpath)
        self.svgRoot = svgTree.getroot()
        self.svgFile = svg.SVG()
        self.svgFile.setSvg(self.svgRoot)
        self.aSection = LinacSection("A", "grey", 0)
        self.bSection = LinacSection("B", "pink", 630)
        self.aSection.updateSvg()
        self.bSection.updateSvg()

    def testBigCaption(self):
        zoomNode = self.svgFile.getZoom1Background()
        bigCaptionNode = self.svgFile.getElementById("section1BigCaption", zoomNode)
        bigCaption = self.svgFile.getElementById("section1BigCaptionTextPath", bigCaptionNode)
        self.assertEqual(bigCaption.text, "A")
        self.assertEqual(bigCaptionNode.attrib["style"], "font-size:150.0px;font-style:normal;'")

        secondBigCaptionNode = self.svgFile.getElementById("section2BigCaption", zoomNode)
        secondBigCaption = self.svgFile.getElementById("section2BigCaptionTextPath", secondBigCaptionNode)
        self.assertEqual(secondBigCaption.text, "B")

    def testBigRect(self):
        zoomNode = self.svgFile.getZoom1Background()
        bigRect = self.svgFile.getElementById("section1bigRect", zoomNode)
        self.assertEqual(bigRect.attrib["x"], "0")
        self.assertEqual(bigRect.attrib["y"], "3495")
        self.assertEqual(bigRect.attrib["width"], "630")
        self.assertEqual(bigRect.attrib["height"], "209.99997")
        self.assertEqual(bigRect.attrib["style"], "fill:grey;fill-opacity:0.79803922;stroke:none")
        secondBigCaption = self.svgFile.getElementById("section2bigRect", zoomNode)
        self.assertEqual(secondBigCaption.attrib["x"], "630")
        self.assertEqual(secondBigCaption.attrib["y"], "3495")

    def testSmallCaption(self):
        zoomNode = self.svgFile.getZoom2Background()
        smallCaptionNode = self.svgFile.getElementById("section1SmallCaption", zoomNode)
        smallCaption = self.svgFile.getElementById("section1SmallCaptionTextPath", smallCaptionNode)
        self.assertEqual(smallCaptionNode.attrib["text-anchor"], "middle")
        self.assertEqual(smallCaption.text, "A")

    def testBottomRect(self):
        zoomNode = self.svgFile.getZoom2Background()
        bottomRect = self.svgFile.getElementById("section1bottomRect", zoomNode)
        self.assertEqual(bottomRect.attrib["x"], "0")
        self.assertEqual(bottomRect.attrib["y"], "3685")
        self.assertEqual(bottomRect.attrib["width"], "630")
        self.assertEqual(bottomRect.attrib["height"], "19.999943")
        self.assertEqual(bottomRect.attrib["style"], "fill:grey;fill-opacity:0.79803922;stroke:none;display:inline")

    def testVerticalLine(self):
        zoomNode = self.svgFile.getZoom2Background()
        verticalLine = self.svgFile.getElementById("section2verticalLine", zoomNode)
        self.assertEqual(verticalLine.attrib["x"], "1260")
        self.assertEqual(verticalLine.attrib["y"], "3594.144")
        self.assertEqual(verticalLine.attrib["width"], "0.85600001")
        self.assertEqual(verticalLine.attrib["height"], "109.856")
        self.assertEqual(verticalLine.attrib["style"], "fill:#3c3c3c;fill-opacity:0.74901961")

    def testDisplayedName(self):
        cSection = LinacSection("C", "green", 640)
        cSection.setDisplayedName("ABCDEFGH")
        cSection.updateSvg()

        zoomNode = self.svgFile.getZoom2Background()
        smallCaptionNode = self.svgFile.getElementById("section3SmallCaption", zoomNode)
        smallCaption = self.svgFile.getElementById("section3SmallCaptionTextPath", smallCaptionNode)
        self.assertEqual(smallCaption.text, "ABCDEFGH")

        zoomNode = self.svgFile.getZoom1Background()
        bigCaptionNode = self.svgFile.getElementById("section3BigCaption", zoomNode)
        bigCaption = self.svgFile.getElementById("section3BigCaptionTextPath", bigCaptionNode)
        self.assertEqual(bigCaption.text, "ABCDEFGH")

    def tearDown(self):
        LinacSection.id = 1
Exemple #6
0
class TestSectionElements(unittest.TestCase):
    def setUp(self):
        blankSVGpath = './blank.svg'
        svgTree = etree.parse(blankSVGpath)
        self.svgRoot = svgTree.getroot()
        self.svgFile = svg.SVG()
        self.svgFile.setSvg(self.svgRoot)
        self.aSection = LinacSection("A","grey", 0)
        self.bSection = LinacSection("B", "pink", 630)
        self.aSection.updateSvg()
        self.bSection.updateSvg()

    def testBigCaption(self):
        zoomNode = self.svgFile.getZoom1Background()
        bigCaptionNode = self.svgFile.getElementById("section1BigCaption", zoomNode)
        bigCaption =  self.svgFile.getElementById("section1BigCaptionTextPath", bigCaptionNode)
        self.assertEqual(bigCaption.text, "A")
        self.assertEqual(bigCaptionNode.attrib["style"], "font-size:150.0px;font-style:normal;'")

        secondBigCaptionNode = self.svgFile.getElementById("section2BigCaption", zoomNode)
        secondBigCaption =  self.svgFile.getElementById("section2BigCaptionTextPath", secondBigCaptionNode)
        self.assertEqual(secondBigCaption.text, "B")

    def testBigRect(self):
        zoomNode = self.svgFile.getZoom1Background()
        bigRect = self.svgFile.getElementById("section1bigRect", zoomNode)
        self.assertEqual(bigRect.attrib["x"], "0")
        self.assertEqual(bigRect.attrib["y"], "3495")
        self.assertEqual(bigRect.attrib["width"], "630")
        self.assertEqual(bigRect.attrib["height"], "209.99997")
        self.assertEqual(bigRect.attrib["style"], "fill:grey;fill-opacity:0.79803922;stroke:none")
        secondBigCaption = self.svgFile.getElementById("section2bigRect", zoomNode)
        self.assertEqual(secondBigCaption.attrib["x"], "630")
        self.assertEqual(secondBigCaption.attrib["y"], "3495")

    def testSmallCaption(self):
        zoomNode = self.svgFile.getZoom2Background()
        smallCaptionNode = self.svgFile.getElementById("section1SmallCaption", zoomNode)
        smallCaption = self.svgFile.getElementById("section1SmallCaptionTextPath", smallCaptionNode)
        self.assertEqual(smallCaptionNode.attrib["text-anchor"], "middle")
        self.assertEqual(smallCaption.text, "A")

    def testBottomRect(self):
        zoomNode = self.svgFile.getZoom2Background()
        bottomRect = self.svgFile.getElementById("section1bottomRect", zoomNode)
        self.assertEqual(bottomRect.attrib["x"], "0")
        self.assertEqual(bottomRect.attrib["y"], "3685")
        self.assertEqual(bottomRect.attrib["width"], "630")
        self.assertEqual(bottomRect.attrib["height"], "19.999943")
        self.assertEqual(bottomRect.attrib["style"], "fill:grey;fill-opacity:0.79803922;stroke:none;display:inline")

    def testVerticalLine(self):
        zoomNode = self.svgFile.getZoom2Background()
        verticalLine = self.svgFile.getElementById("section2verticalLine", zoomNode)
        self.assertEqual(verticalLine.attrib["x"], "1260")
        self.assertEqual(verticalLine.attrib["y"], "3594.144")
        self.assertEqual(verticalLine.attrib["width"], "0.85600001")
        self.assertEqual(verticalLine.attrib["height"], "109.856")
        self.assertEqual(verticalLine.attrib["style"], "fill:#3c3c3c;fill-opacity:0.74901961")

    def testDisplayedName(self):
        cSection = LinacSection("C", "green", 640)
        cSection.setDisplayedName("ABCDEFGH")
        cSection.updateSvg()

        zoomNode = self.svgFile.getZoom2Background()
        smallCaptionNode = self.svgFile.getElementById("section3SmallCaption", zoomNode)
        smallCaption = self.svgFile.getElementById("section3SmallCaptionTextPath", smallCaptionNode)
        self.assertEqual(smallCaption.text, "ABCDEFGH")

        zoomNode = self.svgFile.getZoom1Background()
        bigCaptionNode = self.svgFile.getElementById("section3BigCaption", zoomNode)
        bigCaption = self.svgFile.getElementById("section3BigCaptionTextPath", bigCaptionNode)
        self.assertEqual(bigCaption.text, "ABCDEFGH")

    def tearDown(self):
        LinacSection.id = 1