コード例 #1
0
ファイル: oneCore.py プロジェクト: supertanglang/nvda
	def _convertProsody(self, command, attr, default, base):
		if command.multiplier == 1 and base == default:
			# Returning to synth default.
			return speechXml.DelAttrCommand("prosody", attr)
		else:
			# Multiplication isn't supported, only addition/subtraction.
			# The final value must therefore be relative to the synthesizer's default.
			val = base * command.multiplier - default
			return speechXml.SetAttrCommand("prosody", attr, "%d%%" % val)
コード例 #2
0
    def test_delSingleAttrOfMultipleAttrs(self):
        """Tests DelAttrCommand removing a single attribute from a tag which has multiple attributes.
		"""
        xml = self.balancer.generateXml([
            speechXml.SetAttrCommand("prosody", "pitch", 50),
            speechXml.SetAttrCommand("prosody", "volume", 60), "t1",
            speechXml.DelAttrCommand("prosody", "pitch"), "t2"
        ])
        self.assertEqual(
            xml,
            '<prosody pitch="50" volume="60">t1</prosody><prosody volume="60">t2</prosody>'
        )
コード例 #3
0
    def test_delAttrUnbalanced(self):
        """Tests DelAttrCommand removing an outer tag before an inner tag.
		"""
        xml = self.balancer.generateXml([
            speechXml.SetAttrCommand("pitch", "val", 50),
            speechXml.SetAttrCommand("volume", "val", 60), "t1",
            speechXml.DelAttrCommand("pitch", "val"), "t2"
        ])
        self.assertEqual(
            xml,
            '<pitch val="50"><volume val="60">t1</volume></pitch><volume val="60">t2</volume>'
        )
コード例 #4
0
 def test_setAttrThenDelAttr(self):
     xml = self.balancer.generateXml([
         speechXml.SetAttrCommand("pitch", "val", 50), "t1",
         speechXml.DelAttrCommand("pitch", "val"), "t2"
     ])
     self.assertEqual(xml, '<pitch val="50">t1</pitch>t2')
コード例 #5
0
 def test_delAttrNoSetAttr(self):
     xml = self.balancer.generateXml(
         [speechXml.DelAttrCommand("pitch", "val"), "text"])
     self.assertEqual(xml, 'text')