#This file was originally generated by NovalIDE's unitest wizard
import unittest
import noval.util.strutils as strutils
import noval.python.parser.utils as parserutils
import noval.util.fileutils as fileutils
import wx

class TestGlobalFunction(unittest.TestCase):
    def setUp(self):
        pass
    def tearDown(self):
        pass

    def testRGBToHex(self):
        print strutils.RGBToHex(wx.Colour(0,0,0))
        print strutils.RGBToHex(wx.Colour(0xFF,0xFF,0xFF))
        print strutils.RGBToHex(wx.Colour(240,240,250))
        
    def testGetFilenameWithoutExt(self):
        name = strutils.GetFilenameWithoutExt("abc")
        self.assertEqual(name,"abc")
        
        name = strutils.GetFilenameWithoutExt("a.b.c")
        self.assertEqual(name,"a.b")
        
        name = strutils.GetFilenameWithoutExt("a.b")
        self.assertEqual(name,"a")
        

        name = strutils.GetFilenameWithoutExt("c:\\user\\a.b.c")
        self.assertEqual(name,"a.b")


        name = strutils.GetFilenameWithoutExt("/usr/bin/a.b.c")
        self.assertEqual(name,"a.b")
        
    def testWindowsComparePath(self):
        self.assertEqual(parserutils.ComparePath("c:\\1.txt","C:\\1.TXT"),True)
        self.assertEqual(parserutils.ComparePath("c:\\1.txt\\","C:\\1.TXT"),True)
        
    def ___testLinuxComparePath(self):
        self.assertEqual(parserutils.ComparePath("/usr/bin/python","/usr/bin/Python"),False)
        self.assertEqual(parserutils.ComparePath("/usr/bin/python/","/usr/bin/Python/"),False)
        self.assertEqual(parserutils.ComparePath("/usr/bin/python","/usr/bin/Python/"),False)
        
        self.assertEqual(parserutils.ComparePath("/usr/bin/python","/usr/bin/python"),True)
        self.assertEqual(parserutils.ComparePath("/usr/bin/python/","/usr/bin/python"),True)
        
    def test_opj_path(self):
        print fileutils.opj("c:\\22.txt")
        print fileutils.opj("c:/22.txt")


if __name__ == "__main__":
    unittest.main()
