(self)
| 1319 | self.assertTrue(config.isInactiveColorSpace("Rec.1886 Rec.2020 - Display")) |
| 1320 | |
| 1321 | def test_roles(self): |
| 1322 | config = OCIO.Config.CreateFromBuiltinConfig("studio-config-v1.0.0_aces-v1.3_ocio-v2.1") |
| 1323 | config.validate() |
| 1324 | |
| 1325 | # ***************************** |
| 1326 | # Test getRoleNames interface. |
| 1327 | # ***************************** |
| 1328 | |
| 1329 | rolesNames = config.getRoleNames() |
| 1330 | |
| 1331 | # Test the numbers of elements. |
| 1332 | self.assertEqual(len(rolesNames), 9) |
| 1333 | |
| 1334 | # Test that the first element is an actual role. |
| 1335 | self.assertTrue(config.hasRole(rolesNames[0])) |
| 1336 | |
| 1337 | # ************************* |
| 1338 | # Test getRoles interface. |
| 1339 | # ************************* |
| 1340 | rolesAndColorspaces = config.getRoles() |
| 1341 | |
| 1342 | # Test the numbers of elements |
| 1343 | self.assertEqual(len(rolesAndColorspaces), 9) |
| 1344 | |
| 1345 | # Test the first element. |
| 1346 | colorspaces = config.getColorSpaces(None) |
| 1347 | |
| 1348 | # Test that the first element has an existing role and an existing colorspace. |
| 1349 | self.assertTrue(config.hasRole(rolesAndColorspaces[0][0])) |
| 1350 | self.assertTrue(colorspaces.hasColorSpace(rolesAndColorspaces[0][1])) |
| 1351 | |
| 1352 | # ********************** |
| 1353 | # Test role resolutions |
| 1354 | # ********************** |
| 1355 | |
| 1356 | self.assertEqual(config.getRoleColorSpace("data"), "Raw") |
| 1357 | self.assertEqual(config.getRoleColorSpace("cie_xyz_d65_interchange"), "CIE-XYZ-D65") |
| 1358 | |
| 1359 | # Test a unknown role. |
| 1360 | self.assertEqual(config.getRoleColorSpace("wrong_role"), "") |
| 1361 | |
| 1362 | # Test an empty input. |
| 1363 | self.assertEqual(config.getRoleColorSpace(""), "") |
| 1364 | |
| 1365 | # ********************** |
| 1366 | # Test role assignation |
| 1367 | # ********************** |
| 1368 | |
| 1369 | # Test that empty role name returns false. |
| 1370 | self.assertFalse(config.hasRole("")) |
| 1371 | |
| 1372 | # Test if color_picking role is present. |
| 1373 | self.assertTrue(config.hasRole("color_picking")) |
| 1374 | |
| 1375 | # Test the original value of the role color_picking. |
| 1376 | self.assertEqual(config.getRoleColorSpace("color_picking"), "sRGB - Texture") |
| 1377 | |
| 1378 | # Change the color space assigned to the role color_picking. |
nothing calls this directly
no test coverage detected