Ejemplo n.º 1
0
    def test_all_passes(self):
        op = zdepth.ZDepthPass(None)
        op._active = True
        self.assertTrue(op.active)

        op = zdepth.ZDepthPass(None)
        op._active = False
        op.active = True
        self.assertTrue(op._active)
Ejemplo n.º 2
0
    def test_should_run(self):
        op = zdepth.ZDepthPass(None)

        op._active = False
        self.assertFalse(op.should_run())

        op._active = True
        self.assertTrue(op.should_run())
Ejemplo n.º 3
0
    def test___init__(self, mocker):
        """Test object initialization."""
        mock_manager = mocker.MagicMock(spec=PyFilterManager)

        op = zdepth.ZDepthPass(mock_manager)

        assert op._data == {"set_pz": False}
        assert not op._active
Ejemplo n.º 4
0
    def test_filterPlane_set_pz_misc(self, mock_get, mock_set):
        mock_get.return_value = "channel1"

        op = zdepth.ZDepthPass(None)
        op._data = {"set_pz": True}

        op.filterPlane()

        mock_set.assert_called_with("plane:disable", True)
Ejemplo n.º 5
0
    def test_filterPlane_Pz_already_set(self, mock_get, mock_set):
        mock_get.return_value = "Pz"

        op = zdepth.ZDepthPass(None)
        op._data = {"set_pz": True}

        op.filterPlane()

        mock_set.assert_called_with("plane:disable", True)
Ejemplo n.º 6
0
    def test_process_parsed_args__none(self):
        namespace = argparse.Namespace()
        namespace.zdepth = None

        op = zdepth.ZDepthPass(None)

        op._active = False

        op.process_parsed_args(namespace)

        self.assertFalse(op.active)
Ejemplo n.º 7
0
    def test_filterPlane_no_pz_Of(self, mock_get, mock_set):
        mock_get.return_value = "Of"

        op = zdepth.ZDepthPass(None)
        op._data = {"set_pz": False}

        op.filterPlane()

        self.assertFalse(op.data["set_pz"])

        mock_set.assert_called_with("plane:disable", True)
Ejemplo n.º 8
0
    def test_filterPlane_no_pz_C(self, mock_get, mock_set):
        mock_get.return_value = "C"

        op = zdepth.ZDepthPass(None)
        op._data = {"set_pz": False}

        op.filterPlane()

        self.assertFalse(op.data["set_pz"])

        mock_set.assert_not_called()
Ejemplo n.º 9
0
    def test_filterInstance__obj_matte(self, mock_get, mock_set):
        mock_get.side_effect = (True, False, "")

        op = zdepth.ZDepthPass(None)

        op.filterInstance()

        calls = [
            call("object:overridedetail", True),
            call("object:phantom", 1)
        ]

        mock_set.asset_has_calls(calls)
Ejemplo n.º 10
0
    def test_filterInstance__set_shader(self, mock_get, mock_set):
        mock_get.side_effect = (False, False, "")

        op = zdepth.ZDepthPass(None)

        op.filterInstance()

        calls = [
            call("object:overridedetail", True),
            call("object:surface", op.CONST_SHADER.split()),
            call("object:displace", None)
        ]

        mock_set.asset_has_calls(calls)
Ejemplo n.º 11
0
    def test_filterPlane_not_set_misc_channel(self, mock_get, mock_set):
        mock_get.return_value = "channel1"

        op = zdepth.ZDepthPass(None)
        op._data = {"set_pz": False}

        op.filterPlane()

        self.assertTrue(op.data["set_pz"])

        calls = [
            call("plane:variable", "Pz"),
            call("plane:vextype", "float"),
            call("plane:channel", "Pz"),
            call("plane:pfilter", "minmax min"),
            call("plane:quantize", None),
        ]

        mock_set.assert_has_calls(calls)
Ejemplo n.º 12
0
    def test___init__(self):
        mock_manager = MagicMock(spec=PyFilterManager)
        op = zdepth.ZDepthPass(mock_manager)

        self.assertEqual(op._data, {"set_pz": False})
        self.assertFalse(op._active)
Ejemplo n.º 13
0
 def _create():
     return zdepth.ZDepthPass(None)