File: TestSelectionProxy.py

package info (click to toggle)
uranium 5.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,304 kB
  • sloc: python: 31,765; sh: 132; makefile: 12
file content (50 lines) | stat: -rw-r--r-- 1,376 bytes parent folder | download | duplicates (3)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from unittest import TestCase
from unittest.mock import MagicMock

from UM.Math.AxisAlignedBox import AxisAlignedBox
from UM.Math.Vector import Vector
from UM.Qt.Bindings.SelectionProxy import SelectionProxy
from UM.Scene.SceneNode import SceneNode
from UM.Scene.Selection import Selection
from UM.Operations.TranslateOperation import TranslateOperation


class TestSelectionProxy(TestCase):

    def setUp(self):
        Selection.clear()
        self.proxy = SelectionProxy()

    def tearDown(self):
        Selection.clear()

    def test_hasSelection(self):
        # Nothing is selected by default
        assert not self.proxy.hasSelection

        node_1 = SceneNode()
        Selection.add(node_1)

        assert self.proxy.hasSelection

        Selection.remove(node_1)
        assert not self.proxy.hasSelection

    def test_selectionCount(self):
        assert self.proxy.selectionCount == 0

        node_1 = SceneNode()
        Selection.add(node_1)
        assert self.proxy.selectionCount == 1

        node_2 = SceneNode()
        Selection.add(node_2)
        assert self.proxy.selectionCount == 2

    def test_selectionNames(self):
        node_1 = SceneNode(name="TestNode1")
        node_2 = SceneNode(name="TestNode2")
        Selection.add(node_2)
        Selection.add(node_1)
        assert self.proxy.selectionNames == ["TestNode2", "TestNode1"]