def testNormalOutput(self): xmb.OutputXmb().Process(self.res_tree, self.xmb_file) output = self.xmb_file.getvalue().decode('utf-8') self.failUnless(output.count('Joi')) self.failUnless(output.count('Yibbee')) self.failUnless( output.count(u'Ol\xe1, \u4eca\u65e5\u306f! \U0001F60A'))
def testLimitList(self): limit_file = StringIO.StringIO( 'IDS_BONGOBINGO\nIDS_DOES_NOT_EXIST\nIDS_ALSO_DOES_NOT_EXIST') xmb.OutputXmb().Process(self.res_tree, self.xmb_file, limit_file, False) output = self.xmb_file.getvalue() self.failUnless(output.count('Yibbee')) self.failUnless(not output.count('Joi'))
def testSubstitution(self): self.res_tree.SetOutputLanguage('en') os.chdir(util.PathFromRoot('.')) # so it can find klonk.rc self.res_tree.RunGatherers() xmb.OutputXmb().Process(self.res_tree, self.xmb_file) output = self.xmb_file.getvalue().decode('utf-8') self.failUnless( output.count('<ph name="GOOD_1"><ex>excellent</ex>[GOOD]</ph>'))
def testLeadingTrailingWhitespace(self): # Regression test for problems outputting messages with leading or # trailing whitespace (these come in via structures only, as # message nodes already strip and store whitespace). self.res_tree.SetOutputLanguage('en') os.chdir(util.PathFromRoot('.')) # so it can find klonk.rc self.res_tree.RunGatherers() xmb.OutputXmb().Process(self.res_tree, self.xmb_file) output = self.xmb_file.getvalue().decode('utf-8') self.failUnless(output.count('OK ? </msg>'))
def testLimitGrd(self): limit_file = StringIO.StringIO('''<?xml version="1.0" encoding="UTF-8"?> <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> <release seq="3"> <messages> <message name="IDS_GREETING" desc="Printed to greet the currently logged in user"> Hello <ph name="USERNAME">%s<ex>Joi</ex></ph>, how are you doing today? </message> </messages> </release> </grit>''') tool = xmb.OutputXmb() class DummyOpts(object): extra_verbose = False tool.o = DummyOpts() tool.Process(self.res_tree, self.xmb_file, limit_file, True, dir='.') output = self.xmb_file.getvalue() self.failUnless(output.count('Joi')) self.failUnless(not output.count('Yibbee'))
def testNormalOutput(self): xmb.OutputXmb().Process(self.res_tree, self.xmb_file) output = self.xmb_file.getvalue() self.failUnless(output.count('Joi') and output.count('Yibbee'))