Test the deepcopy() method.
(self)
| 249 | class ConfigTest(unittest.TestCase): |
| 250 | |
| 251 | def test_copy(self): |
| 252 | """ |
| 253 | Test the deepcopy() method. |
| 254 | """ |
| 255 | cfg = OCIO.Config.CreateRaw() |
| 256 | cfg.setMajorVersion(2) |
| 257 | cfg.setMinorVersion(1) |
| 258 | cfg.setName('test config') |
| 259 | cfg.setDescription('test description') |
| 260 | |
| 261 | cfg.addColorSpace( |
| 262 | OCIO.ColorSpace(OCIO.REFERENCE_SPACE_DISPLAY, |
| 263 | "display_cs", |
| 264 | toReference=OCIO.CDLTransform(sat=1.5))) |
| 265 | cfg.addColorSpace( |
| 266 | OCIO.ColorSpace(OCIO.REFERENCE_SPACE_SCENE, |
| 267 | "raw", |
| 268 | isData=True)) |
| 269 | |
| 270 | rules = OCIO.FileRules() |
| 271 | rules.insertRule(0, 'A', 'raw', '*', 'exr') |
| 272 | rules.insertRule(1, 'B', 'display_cs', '*', 'png') |
| 273 | cfg.setFileRules(rules) |
| 274 | |
| 275 | other = copy.deepcopy(cfg) |
| 276 | self.assertFalse(other is cfg) |
| 277 | |
| 278 | self.assertEqual(other.getMajorVersion(), cfg.getMajorVersion()) |
| 279 | self.assertEqual(other.getMinorVersion(), cfg.getMinorVersion()) |
| 280 | self.assertEqual(other.getName(), cfg.getName()) |
| 281 | self.assertEqual(other.getDescription(), cfg.getDescription()) |
| 282 | self.assertEqual(list(other.getColorSpaceNames()), list(cfg.getColorSpaceNames())) |
| 283 | self.assertEqual(other.getFileRules().getNumEntries(), cfg.getFileRules().getNumEntries()) |
| 284 | |
| 285 | # Check that the file rules are not shared between the two config instances. |
| 286 | rules.removeRule(0) |
| 287 | other.setFileRules(rules) |
| 288 | self.assertEqual(other.getFileRules().getNumEntries(), cfg.getFileRules().getNumEntries() - 1) |
| 289 | |
| 290 | def test_shared_views(self): |
| 291 | # Test these Config functions: addSharedView, getSharedViews, removeSharedView, clearSharedViews. |
nothing calls this directly
no test coverage detected