1#!/usr/bin/env python 2# Copyright (c) 2012 The Chromium Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6'''Unit tests for grit.node.custom.filename''' 7 8from __future__ import print_function 9 10import os 11import sys 12if __name__ == '__main__': 13 sys.path.append(os.path.join(os.path.dirname(__file__), '../../..')) 14 15import unittest 16from grit.node.custom import filename 17from grit import clique 18from grit import tclib 19 20 21class WindowsFilenameUnittest(unittest.TestCase): 22 23 def testValidate(self): 24 factory = clique.UberClique() 25 msg = tclib.Message(text='Bingo bongo') 26 c = factory.MakeClique(msg) 27 c.SetCustomType(filename.WindowsFilename()) 28 translation = tclib.Translation(id=msg.GetId(), text='Bilingo bolongo:') 29 c.AddTranslation(translation, 'fr') 30 self.failUnless(c.MessageForLanguage('fr').GetRealContent() == 'Bilingo bolongo ') 31 32 33if __name__ == '__main__': 34 unittest.main() 35