From f6d532328f4ae530e4596081bca266295298d2e9 Mon Sep 17 00:00:00 2001 From: adam-urbanczyk Date: Wed, 29 Jun 2016 21:03:30 +0200 Subject: [PATCH] Extend testNthDistance to test DirectionNthSelector using the new string syntax too --- tests/TestCQSelectors.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/TestCQSelectors.py b/tests/TestCQSelectors.py index 4fa2b72..fdb20cf 100644 --- a/tests/TestCQSelectors.py +++ b/tests/TestCQSelectors.py @@ -189,6 +189,28 @@ class TestCQSelectors(BaseTest): #check if the selected face if normal to the specified Vector self.assertAlmostEqual(val.normalAt().cross(Vector(1,0,0)).Length,0.0) + #repeat the test using string based selector + + #2nd face + val = c.faces('>(1,0,0)[1]').val() + self.assertAlmostEqual(val.Center().x,-1.5) + + #2nd face with inversed selection vector + val = c.faces('>(-1,0,0)[1]').val() + self.assertAlmostEqual(val.Center().x,1.5) + + #2nd last face + val = c.faces('>X[-2]').val() + self.assertAlmostEqual(val.Center().x,1.5) + + #Last face + val = c.faces('>X[-1]').val() + self.assertAlmostEqual(val.Center().x,2.5) + + #check if the selected face if normal to the specified Vector + self.assertAlmostEqual(val.normalAt().cross(Vector(1,0,0)).Length,0.0) + + def testNearestTo(self): c = CQ(makeUnitCube())