| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 '''Unit tests for grit.format.rc''' | 6 '''Unit tests for grit.format.rc''' |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import sys | 10 import sys |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 ICON IDI_KLONK,IDC_MYICON,14,9,20,20 | 269 ICON IDI_KLONK,IDC_MYICON,14,9,20,20 |
| 270 LTEXT "klonk Version ""yibbee"" 1.0",IDC_STATIC,49,10,119,8, | 270 LTEXT "klonk Version ""yibbee"" 1.0",IDC_STATIC,49,10,119,8, |
| 271 SS_NOPREFIX | 271 SS_NOPREFIX |
| 272 LTEXT "Copyright (C) 2005",IDC_STATIC,49,20,119,8 | 272 LTEXT "Copyright (C) 2005",IDC_STATIC,49,20,119,8 |
| 273 DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP | 273 DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP |
| 274 CONTROL "Jack ""Black"" Daniels",IDC_RADIO1,"Button", | 274 CONTROL "Jack ""Black"" Daniels",IDC_RADIO1,"Button", |
| 275 BS_AUTORADIOBUTTON,46,51,84,10 | 275 BS_AUTORADIOBUTTON,46,51,84,10 |
| 276 END''') | 276 END''') |
| 277 | 277 |
| 278 | 278 |
| 279 def testRelativePath(self): | |
| 280 ''' Verify that _MakeRelativePath works in some tricky cases.''' | |
| 281 def TestRelativePathCombinations(base_path, other_path, expected_result): | |
| 282 ''' Verify that the relative path function works for | |
| 283 the given paths regardless of whether or not they end with | |
| 284 a trailing slash.''' | |
| 285 for path1 in [base_path, base_path + os.path.sep]: | |
| 286 for path2 in [other_path, other_path + os.path.sep]: | |
| 287 result = rc._MakeRelativePath(path1, path2) | |
| 288 self.failUnless(result == expected_result) | |
| 289 | |
| 290 # set-up variables | |
| 291 root_dir = 'c:%sa' % os.path.sep | |
| 292 result1 = '..%sabc' % os.path.sep | |
| 293 path1 = root_dir + 'bc' | |
| 294 result2 = 'bc' | |
| 295 path2 = '%s%s%s' % (root_dir, os.path.sep, result2) | |
| 296 # run the tests | |
| 297 TestRelativePathCombinations(root_dir, path1, result1) | |
| 298 TestRelativePathCombinations(root_dir, path2, result2) | |
| 299 | |
| 300 | |
| 301 if __name__ == '__main__': | 279 if __name__ == '__main__': |
| 302 unittest.main() | 280 unittest.main() |
| OLD | NEW |