[go: up one dir, main page]

File: SceneTest.py

package info (click to toggle)
uranium 3.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,876 kB
  • sloc: python: 22,349; sh: 111; makefile: 11
file content (35 lines) | stat: -rw-r--r-- 1,271 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.

import unittest

from UM.Scene.Scene import Scene
from UM.Scene.SceneNode import SceneNode
from UM.Math.Matrix import Matrix
from UM.Math.Vector import Vector
from copy import copy, deepcopy
import numpy

class SceneTest(unittest.TestCase):
    def setUp(self):
        # Called before the first testfunction is executed
        self._scene = Scene()
        self._scene_object = SceneNode()
        self._scene_object2 = SceneNode()
        self._scene_object.addChild(self._scene_object2)
        self._scene.getRoot().addChild(self._scene_object)
        temp_matrix = Matrix()
        temp_matrix.setByTranslation(Vector(10,10,10))
        self._scene_object2.setLocalTransformation(deepcopy(temp_matrix))
        temp_matrix.setByScaleFactor(0.5)
        self._scene_object.setLocalTransformation(temp_matrix)

    def tearDown(self):
        # Called after the last testfunction was executed
        pass

    def test_checkWorldTransformation(self):
        numpy.testing.assert_array_almost_equal(self._scene_object2.getWorldTransformation().getData(), numpy.array([[0.5,0,0,5],[0,0.5,0,5],[0,0,0.5,5],[0,0,0,1]]))

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