From ca706045baffb15a70a87df52043abcee79553fb Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Thu, 27 Oct 2022 14:46:05 -0500 Subject: [PATCH] Update test_app.py to bring up to date with Mainline a2df6ff --- tests/test_app.py | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index c70eecd..50c1deb 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -1018,13 +1018,13 @@ def test_render_colors(main_clean): # object 1 (defualt color) assert not CQ.child(0).ais.HasColor() - + # object 2 r,g,b,a = get_rgba(CQ.child(1).ais) assert( a == 0.5 ) assert( r == 1.0 ) assert( g == 0.0 ) - + # object 3 r,g,b,a = get_rgba(CQ.child(2).ais) assert( a == 0.5) @@ -1058,7 +1058,7 @@ def test_render_colors_console(main_clean): console = win.components['console'] console.execute_command(code_color) - + CQ = obj_tree.CQ # object 1 (defualt color) @@ -1092,7 +1092,37 @@ def test_render_colors_console(main_clean): # check if error occured qtbot.wait(100) assert('Unknown color format' in log.toPlainText().splitlines()[-1]) + +code_shading = \ +''' +import cadquery as cq + +res1 = cq.Workplane('XY').box(5, 7, 5) +res2 = cq.Workplane('XY').box(8, 5, 4) +show_object(res1) +show_object(res2,options={"alpha":0}) +''' + +def test_shading_aspect(main_clean): + qtbot, win = main_clean + + obj_tree = win.components['object_tree'] + editor = win.components['editor'] + debugger = win.components['debugger'] + + editor.set_text(code_shading) + debugger._actions['Run'][0].triggered.emit() + + CQ = obj_tree.CQ + + # get material aspects + ma1 = CQ.child(0).ais.Attributes().ShadingAspect().Material() + ma2 = CQ.child(1).ais.Attributes().ShadingAspect().Material() + + # verify that they are the same + assert ma1.Shininess() == ma2.Shininess() + def test_confirm_new(monkeypatch,editor): qtbot, editor = editor @@ -1433,4 +1463,3 @@ def test_modulefinder(tmp_path, main): qtbot.wait(100) assert("Cannot determine imported modules" in log.toPlainText().splitlines()[-1]) -