| |
|
| | """**************************************************************************
|
| | * *
|
| | * Copyright (c) 2024 Ondsel <development@ondsel.com> *
|
| | * *
|
| | * This file is part of FreeCAD. *
|
| | * *
|
| | * FreeCAD is free software: you can redistribute it and/or modify it *
|
| | * under the terms of the GNU Lesser General Public License as *
|
| | * published by the Free Software Foundation, either version 2.1 of the *
|
| | * License, or (at your option) any later version. *
|
| | * *
|
| | * FreeCAD is distributed in the hope that it will be useful, but *
|
| | * WITHOUT ANY WARRANTY; without even the implied warranty of *
|
| | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
| | * Lesser General Public License for more details. *
|
| | * *
|
| | * You should have received a copy of the GNU Lesser General Public *
|
| | * License along with FreeCAD. If not, see *
|
| | * <https://www.gnu.org/licenses/>. *
|
| | * *
|
| | ***************************************************************************/"""
|
| |
|
| | import FreeCAD, FreeCADGui, unittest
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | class TestGuiDocument(unittest.TestCase):
|
| | def setUp(self):
|
| |
|
| | self.doc = FreeCAD.newDocument("TestDoc")
|
| |
|
| | def tearDown(self):
|
| |
|
| | FreeCAD.closeDocument("TestDoc")
|
| |
|
| | def testGetTreeRootObject(self):
|
| |
|
| | group1 = self.doc.addObject("App::DocumentObjectGroup", "Group1")
|
| | group2 = self.doc.addObject("App::DocumentObjectGroup", "Group2")
|
| | obj1 = self.doc.addObject("App::FeaturePython", "RootObject1")
|
| | part1 = self.doc.addObject("App::Part", "Part1")
|
| |
|
| |
|
| | part1_obj = part1.newObject("App::FeaturePython", "Part1_Object")
|
| | group3 = group2.newObject("App::DocumentObjectGroup", "Group1")
|
| | group1_obj = group3.newObject("App::FeaturePython", "Group1_Object")
|
| |
|
| |
|
| | root_objects = FreeCADGui.getDocument("TestDoc").TreeRootObjects
|
| |
|
| |
|
| | expected_root_objects = [group1, group2, obj1, part1]
|
| | self.assertEqual(set(root_objects), set(expected_root_objects))
|
| |
|