コード例 #1
0
    def test_01(self):
        """CurveCfgXMLRead.test_01(): tests single channel read."""
        # Say in <LgTrack UniqueId="track1">
        xStr = """<LgCurve UniqueId="Cali" xmlns="x-schema:LgSchema2.xml">
    <ChannelName>CALI</ChannelName>
    <Color>FF0000</Color>
    <LeftLimit>6</LeftLimit>
    <LineStyle>LG_DASH_LINE</LineStyle>
    <RightLimit>16</RightLimit>
    <Thickness>2</Thickness>
    <WrapCount>1</WrapCount>
</LgCurve>"""
        root = etree.fromstring(xStr)
        myCcxr = PRESCfgXML.CurveCfgXMLRead(root, "track1", self._fcxr)
        #        print()
        #        print('myCcxr._filmTrackWidthMap [{:d}]'.format(len(myCcxr._filmTrackWidthMap)))
        #        pprint.pprint(myCcxr._filmTrackWidthMap)
        #        print()
        #        print('myCcxr._filmTrackFnMap [{:d}]'.format(len(myCcxr._filmTrackFnMap)))
        #        pprint.pprint(myCcxr._filmTrackFnMap)
        self.assertEqual('Cali', myCcxr.mnem)
        self.assertEqual('CALI', myCcxr.outp)
        self.assertEqual(True, myCcxr.stat)
        self.assertEqual('track1', myCcxr.trac)
        self.assertEqual(
            Stroke.Stroke(width=0.5,
                          colour='rgb(255,0,0)',
                          coding=(4, 4),
                          opacity=1.0),
            myCcxr.codiStroke,
        )
コード例 #2
0
    def test_08(self):
        """CurveCfgXMLRead.test_08(): tests single channel wrap mode UNKNOWN."""
        # Say in <LgTrack UniqueId="track1">
        xStr = """<LgCurve UniqueId="ROP5" xmlns="x-schema:LgSchema2.xml">
    <ChannelName>ROP5</ChannelName>
    <Color>0000FF</Color>
    <LeftLimit>500</LeftLimit>
    <RightLimit>0</RightLimit>
    <LineStyle>LG_DASH_LINE</LineStyle>
    <Thickness>1.75</Thickness>
    <WrapMode>UNKNOWN</WrapMode>
</LgCurve>"""
        root = etree.fromstring(xStr)
        myCcxr = PRESCfgXML.CurveCfgXMLRead(root, "track1", self._fcxr)
コード例 #3
0
    def test_06(self):
        """CurveCfgXMLRead.test_06(): tests single channel read logarithmic."""
        # Say in <LgTrack UniqueId="track1">
        xStr = """<LgCurve UniqueId="PSR" xmlns="x-schema:LgSchema2.xml">
            <ChannelName>PSR</ChannelName>
            <Color>00C000</Color>
            <LeftLimit>0.2</LeftLimit>
            <RightLimit>2000</RightLimit>
            <Thickness>2</Thickness>
            <Transform>LG_LOGARITHMIC</Transform>
            <WrapCount>0</WrapCount>
</LgCurve>"""
        root = etree.fromstring(xStr)
        myCcxr = PRESCfgXML.CurveCfgXMLRead(root, "track1", self._fcxr)
        self.assertFalse(myCcxr.mode is None)
コード例 #4
0
    def test_05(self):
        """CurveCfgXMLRead.test_05(): tests single channel mode is linear."""
        # Say in <LgTrack UniqueId="track1">
        xStr = """<LgCurve UniqueId="Caliper" xmlns="x-schema:LgSchema2.xml">
    <ChannelName>CALI</ChannelName>
    <Color>FF0000</Color>
    <LeftLimit>6</LeftLimit>
    <LineStyle>LG_DASH_LINE</LineStyle>
    <RightLimit>16</RightLimit>
    <Thickness>2</Thickness>
    <WrapCount>1</WrapCount>
</LgCurve>"""
        root = etree.fromstring(xStr)
        myCcxr = PRESCfgXML.CurveCfgXMLRead(root, "track1", self._fcxr)
        self.assertTrue(myCcxr.mode is None)
コード例 #5
0
    def test_00_02(self):
        """CurveCfgXMLRead.test_00_02(): tests low-level: _retBackup() UNKNOWN."""
        # Say in <LgTrack UniqueId="track1">
        xStr = """<LgCurve UniqueId="Cali" xmlns="x-schema:LgSchema2.xml">
    <ChannelName>CALI</ChannelName>
    <Color>FF0000</Color>
    <LeftLimit>6</LeftLimit>
    <LineStyle>LG_DASH_LINE</LineStyle>
    <RightLimit>16</RightLimit>
    <Thickness>2</Thickness>
    <WrapCount>1</WrapCount>
</LgCurve>"""
        root = etree.fromstring(xStr)
        myCcxr = PRESCfgXML.CurveCfgXMLRead(root, "track1", self._fcxr)
        myB = myCcxr._retBackup(
            etree.fromstring("""<LgCurve xmlns="x-schema:LgSchema2.xml">
    <WrapMode>UNKNOWN</WrapMode>
</LgCurve>"""))
        self.assertEqual((0, 0), myB)
コード例 #6
0
    def test_11(self):
        """CurveCfgXMLRead.test_11(): tests single colour OK."""
        # Say in <LgTrack UniqueId="track1">
        xStr = """<LgCurve UniqueId="ROP5" xmlns="x-schema:LgSchema2.xml">
    <ChannelName>ROP5</ChannelName>
    <Color>0000FF</Color>
    <LeftLimit>500</LeftLimit>
    <RightLimit>0</RightLimit>
    <LineStyle>LG_DASH_LINE</LineStyle>
    <Thickness>1.75</Thickness>
    <WrapMode>LG_LEFT_WRAPPED</WrapMode>
</LgCurve>"""
        root = etree.fromstring(xStr)
        myCcxr = PRESCfgXML.CurveCfgXMLRead(root, "track1", self._fcxr)
        self.assertEqual(
            Stroke.Stroke(width=0.5,
                          colour='rgb(0,0,255)',
                          coding=(4, 4),
                          opacity=1.0),
            myCcxr.codiStroke,
        )
コード例 #7
0
    def test_00_11(self):
        """CurveCfgXMLRead.test_00_11(): tests low-level: _retCoding()."""
        # Say in <LgTrack UniqueId="track1">
        xStr = """<LgCurve UniqueId="Cali" xmlns="x-schema:LgSchema2.xml">
    <ChannelName>CALI</ChannelName>
    <Color>FF0000</Color>
    <LeftLimit>6</LeftLimit>
    <LineStyle>LG_DASH_LINE</LineStyle>
    <RightLimit>16</RightLimit>
    <Thickness>2</Thickness>
    <WrapCount>1</WrapCount>
</LgCurve>"""
        root = etree.fromstring(xStr)
        myCcxr = PRESCfgXML.CurveCfgXMLRead(root, "track1", self._fcxr)
        myV = myCcxr._retCoding(
            etree.fromstring("""<LgCurve xmlns="x-schema:LgSchema2.xml">
    <Color>FF0000</Color>
    <LineStyle>LG_DASH_LINE</LineStyle>
</LgCurve>"""))
        self.assertEqual(
            Stroke.Stroke(width=0.5,
                          colour='rgb(255,0,0)',
                          coding=(4, 4),
                          opacity=1.0), myV)