mirror of https://github.com/KLayout/klayout.git
WIP: fixed unit tests for Qt-less build.
This commit is contained in:
parent
58fd6ed143
commit
d2c890ab6d
|
|
@ -157,6 +157,7 @@ TEST(1)
|
||||||
v = e.parse ("var a=A.new; a.push_ev(Enum.a); a.push_ev(Enum.new); a.push_ev(Enum.b); a.ev").execute ();
|
v = e.parse ("var a=A.new; a.push_ev(Enum.a); a.push_ev(Enum.new); a.push_ev(Enum.b); a.ev").execute ();
|
||||||
EXPECT_EQ (v.to_string (), std::string ("a,#0,b"));
|
EXPECT_EQ (v.to_string (), std::string ("a,#0,b"));
|
||||||
|
|
||||||
|
#if defined(HAVE_QT)
|
||||||
v = e.parse ("var a=A.new; a.get_ef").execute ();
|
v = e.parse ("var a=A.new; a.get_ef").execute ();
|
||||||
EXPECT_EQ (v.to_string (), std::string (""));
|
EXPECT_EQ (v.to_string (), std::string (""));
|
||||||
v = e.parse ("var a=A.new; a.set_ef(Enum.a); a.get_ef").execute ();
|
v = e.parse ("var a=A.new; a.set_ef(Enum.a); a.get_ef").execute ();
|
||||||
|
|
@ -204,6 +205,8 @@ TEST(1)
|
||||||
v = e.parse ("var a=A.new; var ef=Enums.new(); a.mod_efref(ef, Enum.b); a.mod_efptr(ef, Enum.a); ef").execute ();
|
v = e.parse ("var a=A.new; var ef=Enums.new(); a.mod_efref(ef, Enum.b); a.mod_efptr(ef, Enum.a); ef").execute ();
|
||||||
EXPECT_EQ (v.to_string (), std::string ("a|b"));
|
EXPECT_EQ (v.to_string (), std::string ("a|b"));
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(2)
|
TEST(2)
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ PYMODTEST (import_QtXmlPatterns, "import_QtXmlPatterns.py")
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#elif defined(HAVE_QT)
|
||||||
|
|
||||||
PYMODTEST (import_lay, "import_lay_noqt.py")
|
PYMODTEST (import_lay, "import_lay_noqt.py")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,15 +184,16 @@ class BasicTest(unittest.TestCase):
|
||||||
self.assertEqual( a.a3("a"), 1 )
|
self.assertEqual( a.a3("a"), 1 )
|
||||||
self.assertEqual( a.a3("ab"), 2 )
|
self.assertEqual( a.a3("ab"), 2 )
|
||||||
self.assertEqual( a.a3("µ"), 2 ) # two UTF8 bytes
|
self.assertEqual( a.a3("µ"), 2 ) # two UTF8 bytes
|
||||||
self.assertEqual( a.a3_qstr("a"), 1 )
|
if "a3_qstr" in a.__dict__:
|
||||||
self.assertEqual( a.a3_qstr("ab"), 2 )
|
self.assertEqual( a.a3_qstr("a"), 1 )
|
||||||
self.assertEqual( a.a3_qstr("µ"), 1 ) # one UTF character
|
self.assertEqual( a.a3_qstr("ab"), 2 )
|
||||||
self.assertEqual( a.a3_qstrref("a"), 1 )
|
self.assertEqual( a.a3_qstr("µ"), 1 ) # one UTF character
|
||||||
self.assertEqual( a.a3_qstrref("ab"), 2 )
|
self.assertEqual( a.a3_qstrref("a"), 1 )
|
||||||
self.assertEqual( a.a3_qstrref("µ"), 1 ) # one UTF character
|
self.assertEqual( a.a3_qstrref("ab"), 2 )
|
||||||
self.assertEqual( a.a3_qba("a"), 1 )
|
self.assertEqual( a.a3_qstrref("µ"), 1 ) # one UTF character
|
||||||
self.assertEqual( a.a3_qba("ab"), 2 )
|
self.assertEqual( a.a3_qba("a"), 1 )
|
||||||
self.assertEqual( a.a3_qba("µ"), 2 ) # two UTF8 bytes
|
self.assertEqual( a.a3_qba("ab"), 2 )
|
||||||
|
self.assertEqual( a.a3_qba("µ"), 2 ) # two UTF8 bytes
|
||||||
self.assertEqual( a.a3(""), 0 )
|
self.assertEqual( a.a3(""), 0 )
|
||||||
|
|
||||||
self.assertEqual( a.a4([1]), 1.0 )
|
self.assertEqual( a.a4([1]), 1.0 )
|
||||||
|
|
@ -303,84 +304,86 @@ class BasicTest(unittest.TestCase):
|
||||||
self.assertEqual( eb < eb, False )
|
self.assertEqual( eb < eb, False )
|
||||||
self.assertEqual( ea < eb, True )
|
self.assertEqual( ea < eb, True )
|
||||||
|
|
||||||
eea = pya.Enums()
|
if "Enums" in pya.__dict__:
|
||||||
eei = pya.Enums(3)
|
|
||||||
eeb = pya.Enums(eb)
|
|
||||||
self.assertEqual( str(eea), "" )
|
|
||||||
self.assertEqual( repr(eea), " (0)" )
|
|
||||||
self.assertEqual( repr(pya.Enums(str(eea))), " (0)" )
|
|
||||||
self.assertEqual( repr(eei), "a|b (3)" )
|
|
||||||
self.assertEqual( repr(pya.Enums(str(eei))), "a|b (3)" )
|
|
||||||
self.assertEqual( repr(eeb), "b (2)" )
|
|
||||||
self.assertEqual( repr(pya.Enums(str(eeb))), "b (2)" )
|
|
||||||
eeab1 = ea | eb
|
|
||||||
eeab2 = ea | pya.Enums(eb)
|
|
||||||
eeab3 = pya.Enums(ea) | eb
|
|
||||||
eeab4 = pya.Enums(ea) | pya.Enums(eb)
|
|
||||||
self.assertEqual( repr(eeab1), "a|b (3)" )
|
|
||||||
self.assertEqual( repr(eeab2), "a|b (3)" )
|
|
||||||
self.assertEqual( repr(eeab3), "a|b (3)" )
|
|
||||||
self.assertEqual( repr(eeab4), "a|b (3)" )
|
|
||||||
# Note: unsigned enum's will produce the long int, signed enums will produce the short one
|
|
||||||
self.assertEqual( repr(~eeab4) == " (-4)" or repr(~eeab4) == " (4294967292)", True )
|
|
||||||
self.assertEqual( repr(eeab4 & ea), "a (1)" )
|
|
||||||
self.assertEqual( repr(eeab4 & eeb), "b (2)" )
|
|
||||||
self.assertEqual( repr(eeab4 ^ eeb), "a (1)" )
|
|
||||||
self.assertEqual( repr(eeab4 ^ eb), "a (1)" )
|
|
||||||
self.assertEqual( repr(eeab4), "a|b (3)" )
|
|
||||||
eeab4 ^= ea
|
|
||||||
self.assertEqual( repr(eeab4), "b (2)" )
|
|
||||||
|
|
||||||
ee = pya.Enum()
|
eea = pya.Enums()
|
||||||
self.assertEqual( str(ee), "#0" )
|
eei = pya.Enums(3)
|
||||||
a.mod_eref( ee, pya.Enum.c )
|
eeb = pya.Enums(eb)
|
||||||
self.assertEqual( str(ee), "c" )
|
self.assertEqual( str(eea), "" )
|
||||||
a.mod_eptr( ee, pya.Enum.a )
|
self.assertEqual( repr(eea), " (0)" )
|
||||||
self.assertEqual( str(ee), "a" )
|
self.assertEqual( repr(pya.Enums(str(eea))), " (0)" )
|
||||||
|
self.assertEqual( repr(eei), "a|b (3)" )
|
||||||
|
self.assertEqual( repr(pya.Enums(str(eei))), "a|b (3)" )
|
||||||
|
self.assertEqual( repr(eeb), "b (2)" )
|
||||||
|
self.assertEqual( repr(pya.Enums(str(eeb))), "b (2)" )
|
||||||
|
eeab1 = ea | eb
|
||||||
|
eeab2 = ea | pya.Enums(eb)
|
||||||
|
eeab3 = pya.Enums(ea) | eb
|
||||||
|
eeab4 = pya.Enums(ea) | pya.Enums(eb)
|
||||||
|
self.assertEqual( repr(eeab1), "a|b (3)" )
|
||||||
|
self.assertEqual( repr(eeab2), "a|b (3)" )
|
||||||
|
self.assertEqual( repr(eeab3), "a|b (3)" )
|
||||||
|
self.assertEqual( repr(eeab4), "a|b (3)" )
|
||||||
|
# Note: unsigned enum's will produce the long int, signed enums will produce the short one
|
||||||
|
self.assertEqual( repr(~eeab4) == " (-4)" or repr(~eeab4) == " (4294967292)", True )
|
||||||
|
self.assertEqual( repr(eeab4 & ea), "a (1)" )
|
||||||
|
self.assertEqual( repr(eeab4 & eeb), "b (2)" )
|
||||||
|
self.assertEqual( repr(eeab4 ^ eeb), "a (1)" )
|
||||||
|
self.assertEqual( repr(eeab4 ^ eb), "a (1)" )
|
||||||
|
self.assertEqual( repr(eeab4), "a|b (3)" )
|
||||||
|
eeab4 ^= ea
|
||||||
|
self.assertEqual( repr(eeab4), "b (2)" )
|
||||||
|
|
||||||
self.assertEqual( repr(a.ev()), "[]" )
|
ee = pya.Enum()
|
||||||
a.push_ev( pya.Enum.a )
|
self.assertEqual( str(ee), "#0" )
|
||||||
a.push_ev( pya.Enum() )
|
a.mod_eref( ee, pya.Enum.c )
|
||||||
a.push_ev( pya.Enum.b )
|
self.assertEqual( str(ee), "c" )
|
||||||
self.assertEqual( repr(a.ev()), "[a (1), (not a valid enum value), b (2)]" )
|
a.mod_eptr( ee, pya.Enum.a )
|
||||||
|
self.assertEqual( str(ee), "a" )
|
||||||
|
|
||||||
self.assertEqual( repr(a.get_ef()), " (0)" )
|
self.assertEqual( repr(a.ev()), "[]" )
|
||||||
a.set_ef( pya.Enum.a )
|
a.push_ev( pya.Enum.a )
|
||||||
self.assertEqual( str(a.get_ef()), "a" )
|
a.push_ev( pya.Enum() )
|
||||||
a.set_ef( pya.Enums(pya.Enum.b) )
|
a.push_ev( pya.Enum.b )
|
||||||
self.assertEqual( str(a.get_ef()), "b" )
|
self.assertEqual( repr(a.ev()), "[a (1), (not a valid enum value), b (2)]" )
|
||||||
a.set_efptr( None )
|
|
||||||
self.assertEqual( repr(a.get_ef()), " (0)" )
|
|
||||||
a.set_efptr( pya.Enums(pya.Enum.c) )
|
|
||||||
self.assertEqual( str(a.get_ef()), "a|b|c" )
|
|
||||||
a.set_efcptr( None )
|
|
||||||
self.assertEqual( repr(a.get_ef()), " (0)" )
|
|
||||||
a.set_efcptr( pya.Enums(pya.Enum.b) )
|
|
||||||
self.assertEqual( str(a.get_ef()), "b" )
|
|
||||||
a.set_efcptr( pya.Enum.c )
|
|
||||||
self.assertEqual( str(a.get_ef()), "a|b|c" )
|
|
||||||
a.set_efcref( pya.Enum.b )
|
|
||||||
self.assertEqual( str(a.get_ef()), "b" )
|
|
||||||
a.set_efcref( pya.Enums(pya.Enum.a) )
|
|
||||||
self.assertEqual( str(a.get_ef()), "a" )
|
|
||||||
a.set_efref( pya.Enums(pya.Enum.c) )
|
|
||||||
self.assertEqual( str(a.get_ef()), "a|b|c" )
|
|
||||||
self.assertEqual( str(a.get_efptr()), "a|b|c" )
|
|
||||||
self.assertEqual( str(a.get_efref()), "a|b|c" )
|
|
||||||
self.assertEqual( str(a.get_efcptr()), "a|b|c" )
|
|
||||||
self.assertEqual( str(a.get_efcref()), "a|b|c" )
|
|
||||||
a.set_efcptr( None )
|
|
||||||
self.assertEqual( a.get_efcptr(), None )
|
|
||||||
self.assertEqual( repr(a.get_efcref()), " (0)" )
|
|
||||||
self.assertEqual( a.get_efptr(), None )
|
|
||||||
self.assertEqual( repr(a.get_efref()), " (0)" )
|
|
||||||
|
|
||||||
ee = pya.Enums()
|
self.assertEqual( repr(a.get_ef()), " (0)" )
|
||||||
self.assertEqual( repr(ee), " (0)" )
|
a.set_ef( pya.Enum.a )
|
||||||
a.mod_efref( ee, pya.Enum.b )
|
self.assertEqual( str(a.get_ef()), "a" )
|
||||||
self.assertEqual( str(ee), "b" )
|
a.set_ef( pya.Enums(pya.Enum.b) )
|
||||||
a.mod_efptr( ee, pya.Enum.a )
|
self.assertEqual( str(a.get_ef()), "b" )
|
||||||
self.assertEqual( str(ee), "a|b" )
|
a.set_efptr( None )
|
||||||
|
self.assertEqual( repr(a.get_ef()), " (0)" )
|
||||||
|
a.set_efptr( pya.Enums(pya.Enum.c) )
|
||||||
|
self.assertEqual( str(a.get_ef()), "a|b|c" )
|
||||||
|
a.set_efcptr( None )
|
||||||
|
self.assertEqual( repr(a.get_ef()), " (0)" )
|
||||||
|
a.set_efcptr( pya.Enums(pya.Enum.b) )
|
||||||
|
self.assertEqual( str(a.get_ef()), "b" )
|
||||||
|
a.set_efcptr( pya.Enum.c )
|
||||||
|
self.assertEqual( str(a.get_ef()), "a|b|c" )
|
||||||
|
a.set_efcref( pya.Enum.b )
|
||||||
|
self.assertEqual( str(a.get_ef()), "b" )
|
||||||
|
a.set_efcref( pya.Enums(pya.Enum.a) )
|
||||||
|
self.assertEqual( str(a.get_ef()), "a" )
|
||||||
|
a.set_efref( pya.Enums(pya.Enum.c) )
|
||||||
|
self.assertEqual( str(a.get_ef()), "a|b|c" )
|
||||||
|
self.assertEqual( str(a.get_efptr()), "a|b|c" )
|
||||||
|
self.assertEqual( str(a.get_efref()), "a|b|c" )
|
||||||
|
self.assertEqual( str(a.get_efcptr()), "a|b|c" )
|
||||||
|
self.assertEqual( str(a.get_efcref()), "a|b|c" )
|
||||||
|
a.set_efcptr( None )
|
||||||
|
self.assertEqual( a.get_efcptr(), None )
|
||||||
|
self.assertEqual( repr(a.get_efcref()), " (0)" )
|
||||||
|
self.assertEqual( a.get_efptr(), None )
|
||||||
|
self.assertEqual( repr(a.get_efref()), " (0)" )
|
||||||
|
|
||||||
|
ee = pya.Enums()
|
||||||
|
self.assertEqual( repr(ee), " (0)" )
|
||||||
|
a.mod_efref( ee, pya.Enum.b )
|
||||||
|
self.assertEqual( str(ee), "b" )
|
||||||
|
a.mod_efptr( ee, pya.Enum.a )
|
||||||
|
self.assertEqual( str(ee), "a|b" )
|
||||||
|
|
||||||
def test_12(self):
|
def test_12(self):
|
||||||
|
|
||||||
|
|
@ -401,9 +404,10 @@ class BasicTest(unittest.TestCase):
|
||||||
self.assertEqual( a3.a1(), -11 )
|
self.assertEqual( a3.a1(), -11 )
|
||||||
|
|
||||||
self.assertEqual( a1.a10_d(5.2), "5.2" )
|
self.assertEqual( a1.a10_d(5.2), "5.2" )
|
||||||
self.assertEqual( a1.a10_d_qstr(5.25), "5.25" )
|
if "a10_d_qstr" in a1.__dict__:
|
||||||
self.assertEqual( a1.a10_d_qstrref(5.2), "5.2" )
|
self.assertEqual( a1.a10_d_qstr(5.25), "5.25" )
|
||||||
self.assertEqual( a1.a10_d_qba(5.1), "5.1" )
|
self.assertEqual( a1.a10_d_qstrref(5.2), "5.2" )
|
||||||
|
self.assertEqual( a1.a10_d_qba(5.1), "5.1" )
|
||||||
self.assertEqual( a1.a10_f(5.7), "5.7" )
|
self.assertEqual( a1.a10_f(5.7), "5.7" )
|
||||||
x = pya.Value(1.5)
|
x = pya.Value(1.5)
|
||||||
self.assertEqual( str(x.value), "1.5" )
|
self.assertEqual( str(x.value), "1.5" )
|
||||||
|
|
@ -2313,63 +2317,65 @@ class BasicTest(unittest.TestCase):
|
||||||
b.set_ss([])
|
b.set_ss([])
|
||||||
self.assertEqual(b.ss(), [])
|
self.assertEqual(b.ss(), [])
|
||||||
|
|
||||||
v = [ "a", "b" ]
|
if "set_qls" in b.__dict__:
|
||||||
pya.B.push_qls(v, "x")
|
|
||||||
self.assertEqual(v, [ "a", "b", "x" ])
|
|
||||||
b.set_qls([ "1" ])
|
|
||||||
self.assertEqual(b.qls(), [ "1" ])
|
|
||||||
b.set_qls([])
|
|
||||||
self.assertEqual(b.qls(), [])
|
|
||||||
|
|
||||||
v = [ "a", 1 ]
|
v = [ "a", "b" ]
|
||||||
pya.B.push_qlv(v, 2.5)
|
pya.B.push_qls(v, "x")
|
||||||
self.assertEqual(v, [ "a", 1, 2.5 ])
|
self.assertEqual(v, [ "a", "b", "x" ])
|
||||||
b.set_qlv([ 17, "1" ])
|
b.set_qls([ "1" ])
|
||||||
self.assertEqual(b.qlv(), [ 17, "1" ])
|
self.assertEqual(b.qls(), [ "1" ])
|
||||||
b.set_qlv([])
|
b.set_qls([])
|
||||||
self.assertEqual(b.qlv(), [])
|
self.assertEqual(b.qls(), [])
|
||||||
|
|
||||||
v = [ "a", "b" ]
|
v = [ "a", 1 ]
|
||||||
pya.B.push_qsl(v, "x")
|
pya.B.push_qlv(v, 2.5)
|
||||||
self.assertEqual(v, [ "a", "b", "x" ])
|
self.assertEqual(v, [ "a", 1, 2.5 ])
|
||||||
b.set_qsl([ "1" ])
|
b.set_qlv([ 17, "1" ])
|
||||||
self.assertEqual(b.qsl(), [ "1" ])
|
self.assertEqual(b.qlv(), [ 17, "1" ])
|
||||||
b.set_qsl([])
|
b.set_qlv([])
|
||||||
self.assertEqual(b.qsl(), [])
|
self.assertEqual(b.qlv(), [])
|
||||||
|
|
||||||
v = [ "a", "b" ]
|
v = [ "a", "b" ]
|
||||||
pya.B.push_qvs(v, "x")
|
pya.B.push_qsl(v, "x")
|
||||||
self.assertEqual(v, [ "a", "b", "x" ])
|
self.assertEqual(v, [ "a", "b", "x" ])
|
||||||
b.set_qvs([ "1" ])
|
b.set_qsl([ "1" ])
|
||||||
self.assertEqual(b.qvs(), [ "1" ])
|
self.assertEqual(b.qsl(), [ "1" ])
|
||||||
b.set_qvs([])
|
b.set_qsl([])
|
||||||
self.assertEqual(b.qvs(), [])
|
self.assertEqual(b.qsl(), [])
|
||||||
|
|
||||||
v = [ "a", "b" ]
|
v = [ "a", "b" ]
|
||||||
pya.B.push_qss(v, "x")
|
pya.B.push_qvs(v, "x")
|
||||||
v_sorted = v
|
self.assertEqual(v, [ "a", "b", "x" ])
|
||||||
v_sorted.sort()
|
b.set_qvs([ "1" ])
|
||||||
self.assertEqual(v_sorted, [ "a", "b", "x" ])
|
self.assertEqual(b.qvs(), [ "1" ])
|
||||||
b.set_qss([ "1" ])
|
b.set_qvs([])
|
||||||
self.assertEqual(b.qss(), [ "1" ])
|
self.assertEqual(b.qvs(), [])
|
||||||
b.set_qss([])
|
|
||||||
self.assertEqual(b.qss(), [])
|
|
||||||
|
|
||||||
v = { 1: "a", 17: "b" }
|
v = [ "a", "b" ]
|
||||||
pya.B.insert_qmap_is(v, 2, "x")
|
pya.B.push_qss(v, "x")
|
||||||
self.assertEqual(v, { 1: "a", 17: "b", 2: "x" })
|
v_sorted = v
|
||||||
b.set_qmap_is({ 1: "t", 17: "b" })
|
v_sorted.sort()
|
||||||
self.assertEqual(b.qmap_is(), { 1: "t", 17: "b" })
|
self.assertEqual(v_sorted, [ "a", "b", "x" ])
|
||||||
b.set_qmap_is({})
|
b.set_qss([ "1" ])
|
||||||
self.assertEqual(b.qmap_is(), {})
|
self.assertEqual(b.qss(), [ "1" ])
|
||||||
|
b.set_qss([])
|
||||||
|
self.assertEqual(b.qss(), [])
|
||||||
|
|
||||||
v = { 1: "a", 17: "b" }
|
v = { 1: "a", 17: "b" }
|
||||||
pya.B.insert_qhash_is(v, 2, "x")
|
pya.B.insert_qmap_is(v, 2, "x")
|
||||||
self.assertEqual(v, { 1: "a", 17: "b", 2: "x" })
|
self.assertEqual(v, { 1: "a", 17: "b", 2: "x" })
|
||||||
b.set_qhash_is({ 1: "t", 17: "b" })
|
b.set_qmap_is({ 1: "t", 17: "b" })
|
||||||
self.assertEqual(b.qhash_is(), { 1: "t", 17: "b" })
|
self.assertEqual(b.qmap_is(), { 1: "t", 17: "b" })
|
||||||
b.set_qhash_is({})
|
b.set_qmap_is({})
|
||||||
self.assertEqual(b.qhash_is(), {})
|
self.assertEqual(b.qmap_is(), {})
|
||||||
|
|
||||||
|
v = { 1: "a", 17: "b" }
|
||||||
|
pya.B.insert_qhash_is(v, 2, "x")
|
||||||
|
self.assertEqual(v, { 1: "a", 17: "b", 2: "x" })
|
||||||
|
b.set_qhash_is({ 1: "t", 17: "b" })
|
||||||
|
self.assertEqual(b.qhash_is(), { 1: "t", 17: "b" })
|
||||||
|
b.set_qhash_is({})
|
||||||
|
self.assertEqual(b.qhash_is(), {})
|
||||||
|
|
||||||
def test_51(self):
|
def test_51(self):
|
||||||
|
|
||||||
|
|
@ -2390,6 +2396,9 @@ class BasicTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_60(self):
|
def test_60(self):
|
||||||
|
|
||||||
|
if not "SQ" in pya.__dict__:
|
||||||
|
return
|
||||||
|
|
||||||
class SignalCollector(object):
|
class SignalCollector(object):
|
||||||
|
|
||||||
got_s0 = False
|
got_s0 = False
|
||||||
|
|
@ -2483,6 +2492,9 @@ class BasicTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_61(self):
|
def test_61(self):
|
||||||
|
|
||||||
|
if not "SQ" in pya.__dict__:
|
||||||
|
return
|
||||||
|
|
||||||
class SignalCollector(object):
|
class SignalCollector(object):
|
||||||
|
|
||||||
got_s0a = 0
|
got_s0a = 0
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ class DBLayoutTest(unittest.TestCase):
|
||||||
self.assertEqual( inst.nb, 20 )
|
self.assertEqual( inst.nb, 20 )
|
||||||
self.assertEqual( inst.cell_index, c1.cell_index() )
|
self.assertEqual( inst.cell_index, c1.cell_index() )
|
||||||
|
|
||||||
if( pya.Application.instance().is_editable() ):
|
if ly.is_editable():
|
||||||
for inst in c2.each_inst():
|
for inst in c2.each_inst():
|
||||||
c2.erase( inst )
|
c2.erase( inst )
|
||||||
self.assertEqual( c2.bbox().to_s(), "()" )
|
self.assertEqual( c2.bbox().to_s(), "()" )
|
||||||
|
|
@ -566,7 +566,7 @@ class DBLayoutTest(unittest.TestCase):
|
||||||
self.assertEqual( inst.nb, 20 )
|
self.assertEqual( inst.nb, 20 )
|
||||||
self.assertEqual( inst.cell_index, c1.cell_index() )
|
self.assertEqual( inst.cell_index, c1.cell_index() )
|
||||||
|
|
||||||
if( pya.Application.instance().is_editable() ):
|
if ly.is_editable():
|
||||||
for inst in c2.each_inst():
|
for inst in c2.each_inst():
|
||||||
c2.erase( inst )
|
c2.erase( inst )
|
||||||
self.assertEqual( c2.bbox().to_s(), "()" )
|
self.assertEqual( c2.bbox().to_s(), "()" )
|
||||||
|
|
@ -727,9 +727,9 @@ class DBLayoutTest(unittest.TestCase):
|
||||||
# Instances and bboxes (editable mode)
|
# Instances and bboxes (editable mode)
|
||||||
def test_6_Layout_new(self):
|
def test_6_Layout_new(self):
|
||||||
|
|
||||||
if pya.Application.instance().is_editable():
|
ly = pya.Layout()
|
||||||
|
if ly.is_editable():
|
||||||
|
|
||||||
ly = pya.Layout()
|
|
||||||
pv = { 17: "a", "b": [ 1, 5, 7 ] }
|
pv = { 17: "a", "b": [ 1, 5, 7 ] }
|
||||||
pid1 = ly.properties_id( pv )
|
pid1 = ly.properties_id( pv )
|
||||||
pv = { 100: "x" }
|
pv = { 100: "x" }
|
||||||
|
|
@ -831,11 +831,12 @@ class DBLayoutTest(unittest.TestCase):
|
||||||
# Copy/move between cells
|
# Copy/move between cells
|
||||||
def test_7_cells_copy_move(self):
|
def test_7_cells_copy_move(self):
|
||||||
|
|
||||||
|
ly1 = pya.Layout()
|
||||||
|
|
||||||
# because of set_property ...
|
# because of set_property ...
|
||||||
if not pya.Application.instance().is_editable():
|
if not ly1.is_editable():
|
||||||
return
|
return
|
||||||
|
|
||||||
ly1 = pya.Layout()
|
|
||||||
la1 = ly1.insert_layer(pya.LayerInfo(1, 0))
|
la1 = ly1.insert_layer(pya.LayerInfo(1, 0))
|
||||||
lb1 = ly1.insert_layer(pya.LayerInfo(2, 0))
|
lb1 = ly1.insert_layer(pya.LayerInfo(2, 0))
|
||||||
ly1.dbu = 0.001
|
ly1.dbu = 0.001
|
||||||
|
|
@ -1001,7 +1002,7 @@ class DBLayoutTest(unittest.TestCase):
|
||||||
sv.append(i.to_s(True))
|
sv.append(i.to_s(True))
|
||||||
self.assertEqual(";".join(sv), "")
|
self.assertEqual(";".join(sv), "")
|
||||||
|
|
||||||
if pya.Application.instance().is_editable():
|
if ly.is_editable():
|
||||||
|
|
||||||
i1.cell_index = ci3
|
i1.cell_index = ci3
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,57 +81,59 @@ class PCellTestLib(pya.Library):
|
||||||
self.register("PCellTestLib")
|
self.register("PCellTestLib")
|
||||||
|
|
||||||
|
|
||||||
# A PCell based on the declaration helper
|
if "PCellDeclarationHelper" in pya.__dict__:
|
||||||
|
|
||||||
class BoxPCell2(pya.PCellDeclarationHelper):
|
# A PCell based on the declaration helper
|
||||||
|
|
||||||
def __init__(self):
|
class BoxPCell2(pya.PCellDeclarationHelper):
|
||||||
|
|
||||||
super(BoxPCell2, self).__init__()
|
def __init__(self):
|
||||||
|
|
||||||
self.param("layer", self.TypeLayer, "Layer", default = pya.LayerInfo(0, 0))
|
super(BoxPCell2, self).__init__()
|
||||||
self.param("width", self.TypeDouble, "Width", default = 1.0)
|
|
||||||
self.param("height", self.TypeDouble, "Height", default = 1.0)
|
|
||||||
|
|
||||||
def display_text_impl(self):
|
self.param("layer", self.TypeLayer, "Layer", default = pya.LayerInfo(0, 0))
|
||||||
# provide a descriptive text for the cell
|
self.param("width", self.TypeDouble, "Width", default = 1.0)
|
||||||
return "Box2(L=" + str(self.layer) + ",W=" + ('%.3f' % self.width) + ",H=" + ('%.3f' % self.height) + ")"
|
self.param("height", self.TypeDouble, "Height", default = 1.0)
|
||||||
|
|
||||||
def produce_impl(self):
|
def display_text_impl(self):
|
||||||
|
# provide a descriptive text for the cell
|
||||||
|
return "Box2(L=" + str(self.layer) + ",W=" + ('%.3f' % self.width) + ",H=" + ('%.3f' % self.height) + ")"
|
||||||
|
|
||||||
dbu = self.layout.dbu
|
def produce_impl(self):
|
||||||
|
|
||||||
# fetch the parameters
|
dbu = self.layout.dbu
|
||||||
l = self.layer_layer
|
|
||||||
w = self.width / self.layout.dbu
|
|
||||||
h = self.height / self.layout.dbu
|
|
||||||
|
|
||||||
# create the shape
|
# fetch the parameters
|
||||||
self.cell.shapes(l).insert(pya.Box(-w / 2, -h / 2, w / 2, h / 2))
|
l = self.layer_layer
|
||||||
|
w = self.width / self.layout.dbu
|
||||||
|
h = self.height / self.layout.dbu
|
||||||
|
|
||||||
def can_create_from_shape_impl(self):
|
# create the shape
|
||||||
return self.shape.is_box()
|
self.cell.shapes(l).insert(pya.Box(-w / 2, -h / 2, w / 2, h / 2))
|
||||||
|
|
||||||
def transformation_from_shape_impl(self):
|
def can_create_from_shape_impl(self):
|
||||||
return pya.Trans(self.shape.box.center() - pya.Point())
|
return self.shape.is_box()
|
||||||
|
|
||||||
def parameters_from_shape_impl(self):
|
def transformation_from_shape_impl(self):
|
||||||
self.layer = self.layout.get_info(self.layer)
|
return pya.Trans(self.shape.box.center() - pya.Point())
|
||||||
self.width = self.shape.box.width() * self.layout.dbu
|
|
||||||
self.height = self.shape.box.height() * self.layout.dbu
|
|
||||||
|
|
||||||
class PCellTestLib2(pya.Library):
|
def parameters_from_shape_impl(self):
|
||||||
|
self.layer = self.layout.get_info(self.layer)
|
||||||
|
self.width = self.shape.box.width() * self.layout.dbu
|
||||||
|
self.height = self.shape.box.height() * self.layout.dbu
|
||||||
|
|
||||||
def __init__(self):
|
class PCellTestLib2(pya.Library):
|
||||||
|
|
||||||
# set the description
|
def __init__(self):
|
||||||
self.description = "PCell test lib2"
|
|
||||||
|
|
||||||
# create the PCell declarations
|
# set the description
|
||||||
self.layout().register_pcell("Box2", BoxPCell2())
|
self.description = "PCell test lib2"
|
||||||
|
|
||||||
# register us with the name "MyLib"
|
# create the PCell declarations
|
||||||
self.register("PCellTestLib2")
|
self.layout().register_pcell("Box2", BoxPCell2())
|
||||||
|
|
||||||
|
# register us with the name "MyLib"
|
||||||
|
self.register("PCellTestLib2")
|
||||||
|
|
||||||
|
|
||||||
def inspect_LayerInfo(self):
|
def inspect_LayerInfo(self):
|
||||||
|
|
@ -304,6 +306,9 @@ class DBPCellTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_1a(self):
|
def test_1a(self):
|
||||||
|
|
||||||
|
if not "PCellDeclarationHelper" in pya.__dict__:
|
||||||
|
return
|
||||||
|
|
||||||
# instantiate and register the library
|
# instantiate and register the library
|
||||||
tl = PCellTestLib2()
|
tl = PCellTestLib2()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,10 @@ class Ant_TestClass < TestBase
|
||||||
# Annotation object
|
# Annotation object
|
||||||
def test_1
|
def test_1
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
a = RBA::Annotation::new
|
a = RBA::Annotation::new
|
||||||
assert_equal( a.to_s, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global" )
|
assert_equal( a.to_s, "p1=0,0, p2=0,0, fmt=$D, fmt_x=$X, fmt_y=$Y, style=ruler, outline=diag, snap=true, ac=global" )
|
||||||
|
|
||||||
|
|
@ -387,6 +391,10 @@ class Ant_TestClass < TestBase
|
||||||
# Test LayoutView integration
|
# Test LayoutView integration
|
||||||
def test_2
|
def test_2
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
mw = RBA::Application::instance.main_window
|
mw = RBA::Application::instance.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
mw.create_layout( 0 )
|
mw.create_layout( 0 )
|
||||||
|
|
@ -459,6 +467,10 @@ class Ant_TestClass < TestBase
|
||||||
# Test LayoutView integration with live updates
|
# Test LayoutView integration with live updates
|
||||||
def test_3
|
def test_3
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
mw = RBA::Application::instance.main_window
|
mw = RBA::Application::instance.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
mw.create_layout( 0 )
|
mw.create_layout( 0 )
|
||||||
|
|
|
||||||
|
|
@ -86,15 +86,17 @@ class Basic_TestClass < TestBase
|
||||||
assert_equal( a.a3("a"), 1 )
|
assert_equal( a.a3("a"), 1 )
|
||||||
assert_equal( a.a3("ab"), 2 )
|
assert_equal( a.a3("ab"), 2 )
|
||||||
assert_equal( a.a3("µ"), 2 ) # two UTF8 bytes
|
assert_equal( a.a3("µ"), 2 ) # two UTF8 bytes
|
||||||
assert_equal( a.a3_qstr("a"), 1 )
|
if a.respond_to?(:a3_qstr)
|
||||||
assert_equal( a.a3_qstr("ab"), 2 )
|
assert_equal( a.a3_qstr("a"), 1 )
|
||||||
assert_equal( a.a3_qstr("µ"), 1 ) # one UTF8 character
|
assert_equal( a.a3_qstr("ab"), 2 )
|
||||||
assert_equal( a.a3_qstrref("a"), 1 )
|
assert_equal( a.a3_qstr("µ"), 1 ) # one UTF8 character
|
||||||
assert_equal( a.a3_qstrref("ab"), 2 )
|
assert_equal( a.a3_qstrref("a"), 1 )
|
||||||
assert_equal( a.a3_qstrref("µ"), 1 ) # one UTF8 character
|
assert_equal( a.a3_qstrref("ab"), 2 )
|
||||||
assert_equal( a.a3_qba("a"), 1 )
|
assert_equal( a.a3_qstrref("µ"), 1 ) # one UTF8 character
|
||||||
assert_equal( a.a3_qba("ab"), 2 )
|
assert_equal( a.a3_qba("a"), 1 )
|
||||||
assert_equal( a.a3_qba("µ"), 2 ) # two UTF8 bytes
|
assert_equal( a.a3_qba("ab"), 2 )
|
||||||
|
assert_equal( a.a3_qba("µ"), 2 ) # two UTF8 bytes
|
||||||
|
end
|
||||||
assert_equal( a.a3(""), 0 )
|
assert_equal( a.a3(""), 0 )
|
||||||
|
|
||||||
assert_equal( a.a4([1]), 1.0 )
|
assert_equal( a.a4([1]), 1.0 )
|
||||||
|
|
@ -176,111 +178,115 @@ class Basic_TestClass < TestBase
|
||||||
assert_equal( eb < eb, false )
|
assert_equal( eb < eb, false )
|
||||||
assert_equal( ea < eb, true )
|
assert_equal( ea < eb, true )
|
||||||
|
|
||||||
eea = RBA::Enums::new
|
if RBA.constants.member?(:Enums)
|
||||||
eei = RBA::Enums::new(3)
|
|
||||||
eeb = RBA::Enums::new(eb)
|
|
||||||
assert_equal( eea.to_s, "" )
|
|
||||||
assert_equal( eea.inspect, " (0)" )
|
|
||||||
assert_equal( RBA::Enums::new(eea.to_s).inspect, " (0)" )
|
|
||||||
assert_equal( eei.inspect, "a|b (3)" )
|
|
||||||
assert_equal( RBA::Enums::new(eei.to_s).inspect, "a|b (3)" )
|
|
||||||
assert_equal( eeb.inspect, "b (2)" )
|
|
||||||
assert_equal( RBA::Enums::new(eeb.to_s).inspect, "b (2)" )
|
|
||||||
eeab1 = ea | eb
|
|
||||||
eeab2 = ea | RBA::Enums::new(eb)
|
|
||||||
eeab3 = RBA::Enums::new(ea) | eb
|
|
||||||
eeab4 = RBA::Enums::new(ea) | RBA::Enums::new(eb)
|
|
||||||
assert_equal( eeab1.inspect, "a|b (3)" )
|
|
||||||
assert_equal( eeab2.inspect, "a|b (3)" )
|
|
||||||
assert_equal( eeab3.inspect, "a|b (3)" )
|
|
||||||
assert_equal( eeab4.inspect, "a|b (3)" )
|
|
||||||
# Note: unsigned enum's will produce the long int, signed enums will produce the short one
|
|
||||||
assert_equal( (~eeab4).inspect == " (-4)" || (~eeab4).inspect == " (4294967292)", true )
|
|
||||||
assert_equal( (eeab4 & ea).inspect, "a (1)" )
|
|
||||||
assert_equal( (eeab4 & eeb).inspect, "b (2)" )
|
|
||||||
assert_equal( (eeab4 ^ eeb).inspect, "a (1)" )
|
|
||||||
assert_equal( (eeab4 ^ eb).inspect, "a (1)" )
|
|
||||||
assert_equal( eeab4.inspect, "a|b (3)" )
|
|
||||||
eeab4 ^= ea
|
|
||||||
assert_equal( eeab4.inspect, "b (2)" )
|
|
||||||
|
|
||||||
assert_equal( a.get_e.to_s, "#0" )
|
eea = RBA::Enums::new
|
||||||
a.set_e( RBA::Enum::a )
|
eei = RBA::Enums::new(3)
|
||||||
assert_equal( a.get_e.to_s, "a" )
|
eeb = RBA::Enums::new(eb)
|
||||||
a.set_e( RBA::Enum::b )
|
assert_equal( eea.to_s, "" )
|
||||||
assert_equal( a.get_e.to_s, "b" )
|
assert_equal( eea.inspect, " (0)" )
|
||||||
a.set_eptr( nil )
|
assert_equal( RBA::Enums::new(eea.to_s).inspect, " (0)" )
|
||||||
assert_equal( a.get_e.to_s, "#0" )
|
assert_equal( eei.inspect, "a|b (3)" )
|
||||||
a.set_eptr( RBA::Enum::c )
|
assert_equal( RBA::Enums::new(eei.to_s).inspect, "a|b (3)" )
|
||||||
assert_equal( a.get_e.to_s, "c" )
|
assert_equal( eeb.inspect, "b (2)" )
|
||||||
a.set_ecptr( nil )
|
assert_equal( RBA::Enums::new(eeb.to_s).inspect, "b (2)" )
|
||||||
assert_equal( a.get_e.to_s, "#0" )
|
eeab1 = ea | eb
|
||||||
a.set_ecptr( RBA::Enum::b )
|
eeab2 = ea | RBA::Enums::new(eb)
|
||||||
assert_equal( a.get_e.to_s, "b" )
|
eeab3 = RBA::Enums::new(ea) | eb
|
||||||
a.set_ecref( RBA::Enum::a )
|
eeab4 = RBA::Enums::new(ea) | RBA::Enums::new(eb)
|
||||||
assert_equal( a.get_e.to_s, "a" )
|
assert_equal( eeab1.inspect, "a|b (3)" )
|
||||||
a.set_eref( RBA::Enum::c )
|
assert_equal( eeab2.inspect, "a|b (3)" )
|
||||||
assert_equal( a.get_e.to_s, "c" )
|
assert_equal( eeab3.inspect, "a|b (3)" )
|
||||||
assert_equal( a.get_eptr.to_s, "c" )
|
assert_equal( eeab4.inspect, "a|b (3)" )
|
||||||
assert_equal( a.get_eref.to_s, "c" )
|
# Note: unsigned enum's will produce the long int, signed enums will produce the short one
|
||||||
assert_equal( a.get_ecptr.to_s, "c" )
|
assert_equal( (~eeab4).inspect == " (-4)" || (~eeab4).inspect == " (4294967292)", true )
|
||||||
assert_equal( a.get_ecref.to_s, "c" )
|
assert_equal( (eeab4 & ea).inspect, "a (1)" )
|
||||||
a.set_ecptr( nil )
|
assert_equal( (eeab4 & eeb).inspect, "b (2)" )
|
||||||
assert_equal( a.get_ecptr, nil )
|
assert_equal( (eeab4 ^ eeb).inspect, "a (1)" )
|
||||||
assert_equal( a.get_ecref.to_s, "#0" )
|
assert_equal( (eeab4 ^ eb).inspect, "a (1)" )
|
||||||
assert_equal( a.get_eptr, nil )
|
assert_equal( eeab4.inspect, "a|b (3)" )
|
||||||
assert_equal( a.get_eref.to_s, "#0" )
|
eeab4 ^= ea
|
||||||
|
assert_equal( eeab4.inspect, "b (2)" )
|
||||||
|
|
||||||
ee = RBA::Enum::new
|
assert_equal( a.get_e.to_s, "#0" )
|
||||||
assert_equal( ee.to_s, "#0" )
|
a.set_e( RBA::Enum::a )
|
||||||
a.mod_eref( ee, RBA::Enum::c )
|
assert_equal( a.get_e.to_s, "a" )
|
||||||
assert_equal( ee.to_s, "c" )
|
a.set_e( RBA::Enum::b )
|
||||||
a.mod_eptr( ee, RBA::Enum::a )
|
assert_equal( a.get_e.to_s, "b" )
|
||||||
assert_equal( ee.to_s, "a" )
|
a.set_eptr( nil )
|
||||||
|
assert_equal( a.get_e.to_s, "#0" )
|
||||||
|
a.set_eptr( RBA::Enum::c )
|
||||||
|
assert_equal( a.get_e.to_s, "c" )
|
||||||
|
a.set_ecptr( nil )
|
||||||
|
assert_equal( a.get_e.to_s, "#0" )
|
||||||
|
a.set_ecptr( RBA::Enum::b )
|
||||||
|
assert_equal( a.get_e.to_s, "b" )
|
||||||
|
a.set_ecref( RBA::Enum::a )
|
||||||
|
assert_equal( a.get_e.to_s, "a" )
|
||||||
|
a.set_eref( RBA::Enum::c )
|
||||||
|
assert_equal( a.get_e.to_s, "c" )
|
||||||
|
assert_equal( a.get_eptr.to_s, "c" )
|
||||||
|
assert_equal( a.get_eref.to_s, "c" )
|
||||||
|
assert_equal( a.get_ecptr.to_s, "c" )
|
||||||
|
assert_equal( a.get_ecref.to_s, "c" )
|
||||||
|
a.set_ecptr( nil )
|
||||||
|
assert_equal( a.get_ecptr, nil )
|
||||||
|
assert_equal( a.get_ecref.to_s, "#0" )
|
||||||
|
assert_equal( a.get_eptr, nil )
|
||||||
|
assert_equal( a.get_eref.to_s, "#0" )
|
||||||
|
|
||||||
assert_equal( a.ev.inspect, "[]" )
|
ee = RBA::Enum::new
|
||||||
a.push_ev( RBA::Enum::a )
|
assert_equal( ee.to_s, "#0" )
|
||||||
a.push_ev( RBA::Enum::new )
|
a.mod_eref( ee, RBA::Enum::c )
|
||||||
a.push_ev( RBA::Enum::b )
|
assert_equal( ee.to_s, "c" )
|
||||||
assert_equal( a.ev.inspect, "[a (1), (not a valid enum value), b (2)]" )
|
a.mod_eptr( ee, RBA::Enum::a )
|
||||||
|
assert_equal( ee.to_s, "a" )
|
||||||
|
|
||||||
assert_equal( a.get_ef.inspect, " (0)" )
|
assert_equal( a.ev.inspect, "[]" )
|
||||||
a.set_ef( RBA::Enum::a )
|
a.push_ev( RBA::Enum::a )
|
||||||
assert_equal( a.get_ef.to_s, "a" )
|
a.push_ev( RBA::Enum::new )
|
||||||
a.set_ef( RBA::Enums::new(RBA::Enum::b) )
|
a.push_ev( RBA::Enum::b )
|
||||||
assert_equal( a.get_ef.to_s, "b" )
|
assert_equal( a.ev.inspect, "[a (1), (not a valid enum value), b (2)]" )
|
||||||
a.set_efptr( nil )
|
|
||||||
assert_equal( a.get_ef.inspect, " (0)" )
|
|
||||||
a.set_efptr( RBA::Enums::new(RBA::Enum::c) )
|
|
||||||
assert_equal( a.get_ef.to_s, "a|b|c" )
|
|
||||||
a.set_efcptr( nil )
|
|
||||||
assert_equal( a.get_ef.inspect, " (0)" )
|
|
||||||
a.set_efcptr( RBA::Enums::new(RBA::Enum::b) )
|
|
||||||
assert_equal( a.get_ef.to_s, "b" )
|
|
||||||
a.set_efcptr( RBA::Enum::c )
|
|
||||||
assert_equal( a.get_ef.to_s, "a|b|c" )
|
|
||||||
a.set_efcref( RBA::Enum::b )
|
|
||||||
assert_equal( a.get_ef.to_s, "b" )
|
|
||||||
a.set_efcref( RBA::Enums::new(RBA::Enum::a) )
|
|
||||||
assert_equal( a.get_ef.to_s, "a" )
|
|
||||||
a.set_efref( RBA::Enums::new(RBA::Enum::c) )
|
|
||||||
assert_equal( a.get_ef.to_s, "a|b|c" )
|
|
||||||
assert_equal( a.get_efptr.to_s, "a|b|c" )
|
|
||||||
assert_equal( a.get_efref.to_s, "a|b|c" )
|
|
||||||
assert_equal( a.get_efcptr.to_s, "a|b|c" )
|
|
||||||
assert_equal( a.get_efcref.to_s, "a|b|c" )
|
|
||||||
a.set_efcptr( nil )
|
|
||||||
assert_equal( a.get_efcptr, nil )
|
|
||||||
assert_equal( a.get_efcref.inspect, " (0)" )
|
|
||||||
assert_equal( a.get_efptr, nil )
|
|
||||||
assert_equal( a.get_efref.inspect, " (0)" )
|
|
||||||
|
|
||||||
ee = RBA::Enums::new
|
assert_equal( a.get_ef.inspect, " (0)" )
|
||||||
assert_equal( ee.inspect, " (0)" )
|
a.set_ef( RBA::Enum::a )
|
||||||
a.mod_efref( ee, RBA::Enum::b )
|
assert_equal( a.get_ef.to_s, "a" )
|
||||||
assert_equal( ee.to_s, "b" )
|
a.set_ef( RBA::Enums::new(RBA::Enum::b) )
|
||||||
a.mod_efptr( ee, RBA::Enum::a )
|
assert_equal( a.get_ef.to_s, "b" )
|
||||||
assert_equal( ee.to_s, "a|b" )
|
a.set_efptr( nil )
|
||||||
|
assert_equal( a.get_ef.inspect, " (0)" )
|
||||||
|
a.set_efptr( RBA::Enums::new(RBA::Enum::c) )
|
||||||
|
assert_equal( a.get_ef.to_s, "a|b|c" )
|
||||||
|
a.set_efcptr( nil )
|
||||||
|
assert_equal( a.get_ef.inspect, " (0)" )
|
||||||
|
a.set_efcptr( RBA::Enums::new(RBA::Enum::b) )
|
||||||
|
assert_equal( a.get_ef.to_s, "b" )
|
||||||
|
a.set_efcptr( RBA::Enum::c )
|
||||||
|
assert_equal( a.get_ef.to_s, "a|b|c" )
|
||||||
|
a.set_efcref( RBA::Enum::b )
|
||||||
|
assert_equal( a.get_ef.to_s, "b" )
|
||||||
|
a.set_efcref( RBA::Enums::new(RBA::Enum::a) )
|
||||||
|
assert_equal( a.get_ef.to_s, "a" )
|
||||||
|
a.set_efref( RBA::Enums::new(RBA::Enum::c) )
|
||||||
|
assert_equal( a.get_ef.to_s, "a|b|c" )
|
||||||
|
assert_equal( a.get_efptr.to_s, "a|b|c" )
|
||||||
|
assert_equal( a.get_efref.to_s, "a|b|c" )
|
||||||
|
assert_equal( a.get_efcptr.to_s, "a|b|c" )
|
||||||
|
assert_equal( a.get_efcref.to_s, "a|b|c" )
|
||||||
|
a.set_efcptr( nil )
|
||||||
|
assert_equal( a.get_efcptr, nil )
|
||||||
|
assert_equal( a.get_efcref.inspect, " (0)" )
|
||||||
|
assert_equal( a.get_efptr, nil )
|
||||||
|
assert_equal( a.get_efref.inspect, " (0)" )
|
||||||
|
|
||||||
|
ee = RBA::Enums::new
|
||||||
|
assert_equal( ee.inspect, " (0)" )
|
||||||
|
a.mod_efref( ee, RBA::Enum::b )
|
||||||
|
assert_equal( ee.to_s, "b" )
|
||||||
|
a.mod_efptr( ee, RBA::Enum::a )
|
||||||
|
assert_equal( ee.to_s, "a|b" )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -303,9 +309,11 @@ class Basic_TestClass < TestBase
|
||||||
assert_equal( a3.a1, -11 )
|
assert_equal( a3.a1, -11 )
|
||||||
|
|
||||||
assert_equal( a1.a10_d(5.2), "5.2" )
|
assert_equal( a1.a10_d(5.2), "5.2" )
|
||||||
assert_equal( a1.a10_d_qstr(5.25), "5.25" )
|
if a1.respond_to?(:a10_d_qstr)
|
||||||
assert_equal( a1.a10_d_qstrref(5.2), "5.2" )
|
assert_equal( a1.a10_d_qstr(5.25), "5.25" )
|
||||||
assert_equal( a1.a10_d_qba(5.1), "5.1" )
|
assert_equal( a1.a10_d_qstrref(5.2), "5.2" )
|
||||||
|
assert_equal( a1.a10_d_qba(5.1), "5.1" )
|
||||||
|
end
|
||||||
assert_equal( a1.a10_f(5.7), "5.7" )
|
assert_equal( a1.a10_f(5.7), "5.7" )
|
||||||
x = RBA::Value.new(1.5)
|
x = RBA::Value.new(1.5)
|
||||||
assert_equal( x.value.to_s, "1.5" )
|
assert_equal( x.value.to_s, "1.5" )
|
||||||
|
|
@ -2212,61 +2220,65 @@ class Basic_TestClass < TestBase
|
||||||
b.set_ss([])
|
b.set_ss([])
|
||||||
assert_equal(b.ss, [])
|
assert_equal(b.ss, [])
|
||||||
|
|
||||||
v = [ "a", "b" ]
|
if b.respond_to?(:set_qls)
|
||||||
RBA::B::push_qls(v, "x")
|
|
||||||
assert_equal(v, [ "a", "b", "x" ])
|
|
||||||
b.set_qls([ "1" ])
|
|
||||||
assert_equal(b.qls, [ "1" ])
|
|
||||||
b.set_qls([])
|
|
||||||
assert_equal(b.qls, [])
|
|
||||||
|
|
||||||
v = [ "a", 1 ]
|
v = [ "a", "b" ]
|
||||||
RBA::B::push_qlv(v, 2.5)
|
RBA::B::push_qls(v, "x")
|
||||||
assert_equal(v, [ "a", 1, 2.5 ])
|
assert_equal(v, [ "a", "b", "x" ])
|
||||||
b.set_qlv([ 17, "1" ])
|
b.set_qls([ "1" ])
|
||||||
assert_equal(b.qlv, [ 17, "1" ])
|
assert_equal(b.qls, [ "1" ])
|
||||||
b.set_qlv([])
|
b.set_qls([])
|
||||||
assert_equal(b.qlv, [])
|
assert_equal(b.qls, [])
|
||||||
|
|
||||||
v = [ "a", "b" ]
|
v = [ "a", 1 ]
|
||||||
RBA::B::push_qsl(v, "x")
|
RBA::B::push_qlv(v, 2.5)
|
||||||
assert_equal(v, [ "a", "b", "x" ])
|
assert_equal(v, [ "a", 1, 2.5 ])
|
||||||
b.set_qsl([ "1" ])
|
b.set_qlv([ 17, "1" ])
|
||||||
assert_equal(b.qsl, [ "1" ])
|
assert_equal(b.qlv, [ 17, "1" ])
|
||||||
b.set_qsl([])
|
b.set_qlv([])
|
||||||
assert_equal(b.qsl, [])
|
assert_equal(b.qlv, [])
|
||||||
|
|
||||||
v = [ "a", "b" ]
|
v = [ "a", "b" ]
|
||||||
RBA::B::push_qvs(v, "x")
|
RBA::B::push_qsl(v, "x")
|
||||||
assert_equal(v, [ "a", "b", "x" ])
|
assert_equal(v, [ "a", "b", "x" ])
|
||||||
b.set_qvs([ "1" ])
|
b.set_qsl([ "1" ])
|
||||||
assert_equal(b.qvs, [ "1" ])
|
assert_equal(b.qsl, [ "1" ])
|
||||||
b.set_qvs([])
|
b.set_qsl([])
|
||||||
assert_equal(b.qvs, [])
|
assert_equal(b.qsl, [])
|
||||||
|
|
||||||
v = [ "a", "b" ]
|
v = [ "a", "b" ]
|
||||||
RBA::B::push_qss(v, "x")
|
RBA::B::push_qvs(v, "x")
|
||||||
assert_equal(v.sort, [ "a", "b", "x" ])
|
assert_equal(v, [ "a", "b", "x" ])
|
||||||
b.set_qss([ "1" ])
|
b.set_qvs([ "1" ])
|
||||||
assert_equal(b.qss, [ "1" ])
|
assert_equal(b.qvs, [ "1" ])
|
||||||
b.set_qss([])
|
b.set_qvs([])
|
||||||
assert_equal(b.qss, [])
|
assert_equal(b.qvs, [])
|
||||||
|
|
||||||
v = { 1 => "a", 17 => "b" }
|
v = [ "a", "b" ]
|
||||||
RBA::B::insert_qmap_is(v, 2, "x")
|
RBA::B::push_qss(v, "x")
|
||||||
assert_equal(v, { 1 => "a", 17 => "b", 2 => "x" })
|
assert_equal(v.sort, [ "a", "b", "x" ])
|
||||||
b.set_qmap_is({ 1 => "t", 17 => "b" })
|
b.set_qss([ "1" ])
|
||||||
assert_equal(b.qmap_is, { 1 => "t", 17 => "b" })
|
assert_equal(b.qss, [ "1" ])
|
||||||
b.set_qmap_is({})
|
b.set_qss([])
|
||||||
assert_equal(b.qmap_is, {})
|
assert_equal(b.qss, [])
|
||||||
|
|
||||||
v = { 1 => "a", 17 => "b" }
|
v = { 1 => "a", 17 => "b" }
|
||||||
RBA::B::insert_qhash_is(v, 2, "x")
|
RBA::B::insert_qmap_is(v, 2, "x")
|
||||||
assert_equal(v, { 1 => "a", 17 => "b", 2 => "x" })
|
assert_equal(v, { 1 => "a", 17 => "b", 2 => "x" })
|
||||||
b.set_qhash_is({ 1 => "t", 17 => "b" })
|
b.set_qmap_is({ 1 => "t", 17 => "b" })
|
||||||
assert_equal(b.qhash_is, { 1 => "t", 17 => "b" })
|
assert_equal(b.qmap_is, { 1 => "t", 17 => "b" })
|
||||||
b.set_qhash_is({})
|
b.set_qmap_is({})
|
||||||
assert_equal(b.qhash_is, {})
|
assert_equal(b.qmap_is, {})
|
||||||
|
|
||||||
|
v = { 1 => "a", 17 => "b" }
|
||||||
|
RBA::B::insert_qhash_is(v, 2, "x")
|
||||||
|
assert_equal(v, { 1 => "a", 17 => "b", 2 => "x" })
|
||||||
|
b.set_qhash_is({ 1 => "t", 17 => "b" })
|
||||||
|
assert_equal(b.qhash_is, { 1 => "t", 17 => "b" })
|
||||||
|
b.set_qhash_is({})
|
||||||
|
assert_equal(b.qhash_is, {})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -2291,6 +2303,10 @@ class Basic_TestClass < TestBase
|
||||||
|
|
||||||
def test_60
|
def test_60
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:SQ)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
sq = RBA::SQ::new
|
sq = RBA::SQ::new
|
||||||
|
|
||||||
got_s0 = false
|
got_s0 = false
|
||||||
|
|
@ -2353,6 +2369,10 @@ class Basic_TestClass < TestBase
|
||||||
|
|
||||||
def test_61
|
def test_61
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:SQ)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
sq = RBA::SQ::new
|
sq = RBA::SQ::new
|
||||||
|
|
||||||
got_s0a = 0
|
got_s0a = 0
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ class DBGlyph_TestClass < TestBase
|
||||||
def test_1_Glyph
|
def test_1_Glyph
|
||||||
|
|
||||||
tg = RBA::TextGenerator.default_generator
|
tg = RBA::TextGenerator.default_generator
|
||||||
|
|
||||||
|
# TODO: no default generator in non-Qt mode (no resources)
|
||||||
|
tg || return
|
||||||
|
|
||||||
assert_equal(tg.name, "std_font")
|
assert_equal(tg.name, "std_font")
|
||||||
assert_equal(tg.description, "Non-manhattan (0.6 x 0.8 um cell)")
|
assert_equal(tg.description, "Non-manhattan (0.6 x 0.8 um cell)")
|
||||||
assert_equal(tg.width.to_s, "600")
|
assert_equal(tg.width.to_s, "600")
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,7 @@ class DBInstance_TestClass < TestBase
|
||||||
def test_1_InstEdit
|
def test_1_InstEdit
|
||||||
|
|
||||||
# this only works in editable mode
|
# this only works in editable mode
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
@ -224,11 +220,7 @@ class DBInstance_TestClass < TestBase
|
||||||
def test_2_InstEdit
|
def test_2_InstEdit
|
||||||
|
|
||||||
# this only works in editable mode
|
# this only works in editable mode
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
@ -435,11 +427,7 @@ class DBInstance_TestClass < TestBase
|
||||||
def test_4_InstFlatten
|
def test_4_InstFlatten
|
||||||
|
|
||||||
# this only works in editable mode
|
# this only works in editable mode
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
@ -502,11 +490,7 @@ class DBInstance_TestClass < TestBase
|
||||||
def test_5_InstEdit_Double
|
def test_5_InstEdit_Double
|
||||||
|
|
||||||
# this only works in editable mode
|
# this only works in editable mode
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
@ -697,11 +681,7 @@ class DBInstance_TestClass < TestBase
|
||||||
def test_6_InstEdit_Double
|
def test_6_InstEdit_Double
|
||||||
|
|
||||||
# this only works in editable mode
|
# this only works in editable mode
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
|
||||||
|
|
@ -1044,7 +1044,7 @@ END
|
||||||
assert_equal(dump_layer(lll, 1, "c0"), "(0,100;1000,1200); (100,0;1100,1100)")
|
assert_equal(dump_layer(lll, 1, "c0"), "(0,100;1000,1200); (100,0;1100,1100)")
|
||||||
|
|
||||||
# TODO: undo tests crashes in non-editable mode! Should be checked properly.
|
# TODO: undo tests crashes in non-editable mode! Should be checked properly.
|
||||||
if RBA::Application::instance.is_editable?
|
if lll.is_editable?
|
||||||
|
|
||||||
assert_equal(m.has_undo?, true)
|
assert_equal(m.has_undo?, true)
|
||||||
assert_equal(m.has_redo?, false)
|
assert_equal(m.has_redo?, false)
|
||||||
|
|
|
||||||
|
|
@ -97,67 +97,71 @@ class PCellTestLib < RBA::Library
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# A PCell based on the declaration helper
|
if RBA.constants.member?(:PCellDeclarationHelper)
|
||||||
|
|
||||||
class BoxPCell2 < RBA::PCellDeclarationHelper
|
# A PCell based on the declaration helper
|
||||||
|
|
||||||
def initialize
|
class BoxPCell2 < RBA::PCellDeclarationHelper
|
||||||
|
|
||||||
super()
|
def initialize
|
||||||
|
|
||||||
param("layer", BoxPCell2::TypeLayer, "Layer", :default => RBA::LayerInfo::new(0, 0))
|
super()
|
||||||
param("width", BoxPCell2::TypeDouble, "Width", :default => 1.0)
|
|
||||||
param("height", BoxPCell2::TypeDouble, "Height", :default => 1.0)
|
param("layer", BoxPCell2::TypeLayer, "Layer", :default => RBA::LayerInfo::new(0, 0))
|
||||||
|
param("width", BoxPCell2::TypeDouble, "Width", :default => 1.0)
|
||||||
|
param("height", BoxPCell2::TypeDouble, "Height", :default => 1.0)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def display_text_impl
|
||||||
|
# provide a descriptive text for the cell
|
||||||
|
return "Box2(L=" + layer.to_s + ",W=" + ('%.3f' % width) + ",H=" + ('%.3f' % height) + ")"
|
||||||
|
end
|
||||||
|
|
||||||
|
def produce_impl
|
||||||
|
|
||||||
|
# fetch the parameters
|
||||||
|
l = layer_layer
|
||||||
|
w = width / layout.dbu
|
||||||
|
h = height / layout.dbu
|
||||||
|
|
||||||
|
# create the shape
|
||||||
|
cell.shapes(l).insert(RBA::Box::new(-w / 2, -h / 2, w / 2, h / 2))
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def can_create_from_shape_impl
|
||||||
|
return self.shape.is_box?
|
||||||
|
end
|
||||||
|
|
||||||
|
def transformation_from_shape_impl
|
||||||
|
return RBA::Trans::new(shape.box.center - RBA::Point::new)
|
||||||
|
end
|
||||||
|
|
||||||
|
def parameters_from_shape_impl
|
||||||
|
# NOTE: because there is one parameter called "layer" already, we need to use
|
||||||
|
# the "_layer" fallback to access the argument to this method
|
||||||
|
set_layer(_layout.get_info(_layer))
|
||||||
|
set_width(shape.box.width * _layout.dbu)
|
||||||
|
set_height(shape.box.height * _layout.dbu)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_text_impl
|
class PCellTestLib2 < RBA::Library
|
||||||
# provide a descriptive text for the cell
|
|
||||||
return "Box2(L=" + layer.to_s + ",W=" + ('%.3f' % width) + ",H=" + ('%.3f' % height) + ")"
|
|
||||||
end
|
|
||||||
|
|
||||||
def produce_impl
|
def initialize
|
||||||
|
|
||||||
# fetch the parameters
|
# set the description
|
||||||
l = layer_layer
|
description = "PCell test lib2"
|
||||||
w = width / layout.dbu
|
|
||||||
h = height / layout.dbu
|
|
||||||
|
|
||||||
# create the shape
|
# create the PCell declarations
|
||||||
cell.shapes(l).insert(RBA::Box::new(-w / 2, -h / 2, w / 2, h / 2))
|
layout.register_pcell("Box2", BoxPCell2::new)
|
||||||
|
|
||||||
end
|
# register us with the name "MyLib"
|
||||||
|
self.register("PCellTestLib2")
|
||||||
|
|
||||||
def can_create_from_shape_impl
|
end
|
||||||
return self.shape.is_box?
|
|
||||||
end
|
|
||||||
|
|
||||||
def transformation_from_shape_impl
|
|
||||||
return RBA::Trans::new(shape.box.center - RBA::Point::new)
|
|
||||||
end
|
|
||||||
|
|
||||||
def parameters_from_shape_impl
|
|
||||||
# NOTE: because there is one parameter called "layer" already, we need to use
|
|
||||||
# the "_layer" fallback to access the argument to this method
|
|
||||||
set_layer(_layout.get_info(_layer))
|
|
||||||
set_width(shape.box.width * _layout.dbu)
|
|
||||||
set_height(shape.box.height * _layout.dbu)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
class PCellTestLib2 < RBA::Library
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
|
|
||||||
# set the description
|
|
||||||
description = "PCell test lib2"
|
|
||||||
|
|
||||||
# create the PCell declarations
|
|
||||||
layout.register_pcell("Box2", BoxPCell2::new)
|
|
||||||
|
|
||||||
# register us with the name "MyLib"
|
|
||||||
self.register("PCellTestLib2")
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -337,6 +341,10 @@ class DBPCell_TestClass < TestBase
|
||||||
|
|
||||||
def test_1a
|
def test_1a
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:PCellDeclarationHelper)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
# instantiate and register the library
|
# instantiate and register the library
|
||||||
tl = PCellTestLib2::new
|
tl = PCellTestLib2::new
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -592,11 +592,7 @@ class DBShapes_TestClass < TestBase
|
||||||
# Shapes (edit)
|
# Shapes (edit)
|
||||||
def test_7_LayoutEdit
|
def test_7_LayoutEdit
|
||||||
|
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
@ -741,11 +737,7 @@ class DBShapes_TestClass < TestBase
|
||||||
# Shapes (edit, new methods)
|
# Shapes (edit, new methods)
|
||||||
def test_7_LayoutEdit2
|
def test_7_LayoutEdit2
|
||||||
|
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
@ -951,11 +943,7 @@ class DBShapes_TestClass < TestBase
|
||||||
# Shapes (edit, new methods)
|
# Shapes (edit, new methods)
|
||||||
def test_7_DLayoutEdit2
|
def test_7_DLayoutEdit2
|
||||||
|
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
@ -1161,11 +1149,7 @@ class DBShapes_TestClass < TestBase
|
||||||
# Shapes (edit, new methods)
|
# Shapes (edit, new methods)
|
||||||
def test_7_LayoutEdit3
|
def test_7_LayoutEdit3
|
||||||
|
|
||||||
if ! RBA::Application::instance.is_editable?
|
ly = RBA::Layout::new(true)
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
|
||||||
|
|
||||||
ci1 = ly.add_cell( "c1" )
|
ci1 = ly.add_cell( "c1" )
|
||||||
ci2 = ly.add_cell( "c2" )
|
ci2 = ly.add_cell( "c2" )
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,10 @@ END
|
||||||
|
|
||||||
def test_7
|
def test_7
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Image)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
rin = RBA::Region::new
|
rin = RBA::Region::new
|
||||||
rin.insert(RBA::Box::new(0, 0, 100, 200))
|
rin.insert(RBA::Box::new(0, 0, 100, 200))
|
||||||
rin.insert(RBA::Box::new(9900, 9800, 10000, 10000))
|
rin.insert(RBA::Box::new(9900, 9800, 10000, 10000))
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,10 @@ class EDT_TestClass < TestBase
|
||||||
# ObjectInstPath
|
# ObjectInstPath
|
||||||
def test_1
|
def test_1
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:ObjectInstPath)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
ly = RBA::Layout::new
|
ly = RBA::Layout::new
|
||||||
li = ly.insert_layer(RBA::LayerInfo::new(1, 0))
|
li = ly.insert_layer(RBA::LayerInfo::new(1, 0))
|
||||||
tc = ly.create_cell("TOP")
|
tc = ly.create_cell("TOP")
|
||||||
|
|
@ -110,6 +114,10 @@ class EDT_TestClass < TestBase
|
||||||
# Selection
|
# Selection
|
||||||
def test_2
|
def test_2
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
mw = RBA::Application::instance.main_window
|
mw = RBA::Application::instance.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
mw.create_layout( 0 )
|
mw.create_layout( 0 )
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@ class IMG_TestClass < TestBase
|
||||||
|
|
||||||
def test_1
|
def test_1
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:ImageDataMapping)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
dm = RBA::ImageDataMapping.new
|
dm = RBA::ImageDataMapping.new
|
||||||
dm.gamma = 0.5
|
dm.gamma = 0.5
|
||||||
assert_equal(dm.gamma, 0.5)
|
assert_equal(dm.gamma, 0.5)
|
||||||
|
|
@ -62,6 +66,10 @@ class IMG_TestClass < TestBase
|
||||||
|
|
||||||
def test_2
|
def test_2
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Image)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
image = RBA::Image.new
|
image = RBA::Image.new
|
||||||
assert_equal(image.to_s, "empty:")
|
assert_equal(image.to_s, "empty:")
|
||||||
assert_equal(image.is_empty?, true)
|
assert_equal(image.is_empty?, true)
|
||||||
|
|
@ -181,6 +189,10 @@ class IMG_TestClass < TestBase
|
||||||
|
|
||||||
def test_3
|
def test_3
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Image)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
# compatibility with 0.21
|
# compatibility with 0.21
|
||||||
d = []
|
d = []
|
||||||
20000.times { d.push(0.0) }
|
20000.times { d.push(0.0) }
|
||||||
|
|
@ -197,6 +209,10 @@ class IMG_TestClass < TestBase
|
||||||
|
|
||||||
def test_4
|
def test_4
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
mw = RBA::Application.instance.main_window
|
mw = RBA::Application.instance.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
mw.create_layout(0)
|
mw.create_layout(0)
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,10 @@ class LAYLayers_TestClass < TestBase
|
||||||
|
|
||||||
def test_1
|
def test_1
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
@ -213,6 +217,10 @@ class LAYLayers_TestClass < TestBase
|
||||||
|
|
||||||
def test_1a
|
def test_1a
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
@ -424,6 +432,10 @@ class LAYLayers_TestClass < TestBase
|
||||||
|
|
||||||
def test_2
|
def test_2
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
p = RBA::LayerPropertiesNode::new
|
p = RBA::LayerPropertiesNode::new
|
||||||
|
|
||||||
assert_equal( p.source( false ), "*/*@*" )
|
assert_equal( p.source( false ), "*/*@*" )
|
||||||
|
|
@ -667,6 +679,10 @@ class LAYLayers_TestClass < TestBase
|
||||||
# direct replacement of objects and attributes
|
# direct replacement of objects and attributes
|
||||||
def test_3
|
def test_3
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
@ -749,6 +765,10 @@ class LAYLayers_TestClass < TestBase
|
||||||
# propagation of "real" attributes through the hierarchy
|
# propagation of "real" attributes through the hierarchy
|
||||||
def test_4
|
def test_4
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
@ -786,6 +806,10 @@ class LAYLayers_TestClass < TestBase
|
||||||
# delete method of iterator
|
# delete method of iterator
|
||||||
def test_5
|
def test_5
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
@ -830,6 +854,10 @@ class LAYLayers_TestClass < TestBase
|
||||||
# custom stipples and line styles
|
# custom stipples and line styles
|
||||||
def test_6
|
def test_6
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ class LAYLayoutView_TestClass < TestBase
|
||||||
# Basic view creation and MainWindow events
|
# Basic view creation and MainWindow events
|
||||||
def test_1
|
def test_1
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
@ -122,6 +126,10 @@ class LAYLayoutView_TestClass < TestBase
|
||||||
|
|
||||||
def test_2
|
def test_2
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@ class LAYMarkers_TestClass < TestBase
|
||||||
|
|
||||||
def test_1
|
def test_1
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.create_layout(0)
|
mw.create_layout(0)
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,10 @@ class LAYMenuTest_TestClass < TestBase
|
||||||
|
|
||||||
def test_0
|
def test_0
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Action)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
a = RBA::Action::new
|
a = RBA::Action::new
|
||||||
b = a.dup
|
b = a.dup
|
||||||
|
|
||||||
|
|
@ -94,6 +98,10 @@ class LAYMenuTest_TestClass < TestBase
|
||||||
|
|
||||||
def test_1
|
def test_1
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
menu = mw.menu
|
menu = mw.menu
|
||||||
|
|
@ -261,21 +269,29 @@ RESULT
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class MenuHandler < RBA::Action
|
if RBA.constants.member?(:Action)
|
||||||
def initialize( t, k, &action )
|
|
||||||
self.title = t
|
class MenuHandler < RBA::Action
|
||||||
self.shortcut = k
|
def initialize( t, k, &action )
|
||||||
@action = action
|
self.title = t
|
||||||
|
self.shortcut = k
|
||||||
|
@action = action
|
||||||
|
end
|
||||||
|
def triggered
|
||||||
|
@action.call( self )
|
||||||
|
end
|
||||||
|
private
|
||||||
|
@action
|
||||||
end
|
end
|
||||||
def triggered
|
|
||||||
@action.call( self )
|
|
||||||
end
|
|
||||||
private
|
|
||||||
@action
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_2
|
def test_2
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
menu = mw.menu
|
menu = mw.menu
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@ class LAYSession_TestClass < TestBase
|
||||||
|
|
||||||
def test_1
|
def test_1
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
app = RBA::Application.instance
|
app = RBA::Application.instance
|
||||||
mw = app.main_window
|
mw = app.main_window
|
||||||
mw.close_all
|
mw.close_all
|
||||||
|
|
|
||||||
|
|
@ -422,10 +422,12 @@ class RDB_TestClass < TestBase
|
||||||
assert_equal(item.has_tag?(db.tag_id("x1")), false)
|
assert_equal(item.has_tag?(db.tag_id("x1")), false)
|
||||||
assert_equal(item.tags_str, "")
|
assert_equal(item.tags_str, "")
|
||||||
|
|
||||||
is="iVBORw0KGgoAAAANSUhEUgAAACoAAAA0CAIAAABzfT3nAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAA3UlEQVRYhe2WwQ3DIAxFoco8XaGZIaeO43FyYgZYgYXcQ6SWuDGgBhWq/qccIvGCEd9SbAwAAPSGaW2lFR2rfWDpXrPpSe2SP10fvnn/PZHZH9IwbKFVZZ/Z6wMtZcjW02Bn2FVpZYdWdkr2nvh23S2FyDNJuVITpwmRjTGbNr0v20U5byNtJuuJt/fO2f93+UlbEJl5UjVPr3Y71EQ/PoPPlU+lDJtWlCt3GwCMG33BuJGAcWMEMG6c1jBudCyf/nzV8nbZPRohclFLHdGbZ8eNSjN1fmf0AACA1jwA4hKxu4C6P7EAAAAASUVORK5CYII="
|
if item.respond_to?(:image_str)
|
||||||
item.image_str=is
|
is="iVBORw0KGgoAAAANSUhEUgAAACoAAAA0CAIAAABzfT3nAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAA3UlEQVRYhe2WwQ3DIAxFoco8XaGZIaeO43FyYgZYgYXcQ6SWuDGgBhWq/qccIvGCEd9SbAwAAPSGaW2lFR2rfWDpXrPpSe2SP10fvnn/PZHZH9IwbKFVZZ/Z6wMtZcjW02Bn2FVpZYdWdkr2nvh23S2FyDNJuVITpwmRjTGbNr0v20U5byNtJuuJt/fO2f93+UlbEJl5UjVPr3Y71EQ/PoPPlU+lDJtWlCt3GwCMG33BuJGAcWMEMG6c1jBudCyf/nzV8nbZPRohclFLHdGbZ8eNSjN1fmf0AACA1jwA4hKxu4C6P7EAAAAASUVORK5CYII="
|
||||||
# Only the first 30 bytes count ... the remaining part is too different for different versions of Qt
|
item.image_str=is
|
||||||
assert_equal(item.image_str[0..30], is[0..30])
|
# Only the first 30 bytes count ... the remaining part is too different for different versions of Qt
|
||||||
|
assert_equal(item.image_str[0..30], is[0..30])
|
||||||
|
end
|
||||||
|
|
||||||
vs = RBA::RdbItemValue.new("a string")
|
vs = RBA::RdbItemValue.new("a string")
|
||||||
vs2 = RBA::RdbItemValue.new("a string (ii)")
|
vs2 = RBA::RdbItemValue.new("a string (ii)")
|
||||||
|
|
@ -599,7 +601,9 @@ class RDB_TestClass < TestBase
|
||||||
item.add_tag(db.tag_id("x1"))
|
item.add_tag(db.tag_id("x1"))
|
||||||
item.add_tag(db.user_tag_id("x2"))
|
item.add_tag(db.user_tag_id("x2"))
|
||||||
is="iVBORw0KGgoAAAANSUhEUgAAACoAAAA0CAIAAABzfT3nAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAA3UlEQVRYhe2WwQ3DIAxFoco8XaGZIaeO43FyYgZYgYXcQ6SWuDGgBhWq/qccIvGCEd9SbAwAAPSGaW2lFR2rfWDpXrPpSe2SP10fvnn/PZHZH9IwbKFVZZ/Z6wMtZcjW02Bn2FVpZYdWdkr2nvh23S2FyDNJuVITpwmRjTGbNr0v20U5byNtJuuJt/fO2f93+UlbEJl5UjVPr3Y71EQ/PoPPlU+lDJtWlCt3GwCMG33BuJGAcWMEMG6c1jBudCyf/nzV8nbZPRohclFLHdGbZ8eNSjN1fmf0AACA1jwA4hKxu4C6P7EAAAAASUVORK5CYII="
|
is="iVBORw0KGgoAAAANSUhEUgAAACoAAAA0CAIAAABzfT3nAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAA3UlEQVRYhe2WwQ3DIAxFoco8XaGZIaeO43FyYgZYgYXcQ6SWuDGgBhWq/qccIvGCEd9SbAwAAPSGaW2lFR2rfWDpXrPpSe2SP10fvnn/PZHZH9IwbKFVZZ/Z6wMtZcjW02Bn2FVpZYdWdkr2nvh23S2FyDNJuVITpwmRjTGbNr0v20U5byNtJuuJt/fO2f93+UlbEJl5UjVPr3Y71EQ/PoPPlU+lDJtWlCt3GwCMG33BuJGAcWMEMG6c1jBudCyf/nzV8nbZPRohclFLHdGbZ8eNSjN1fmf0AACA1jwA4hKxu4C6P7EAAAAASUVORK5CYII="
|
||||||
item.image_str=is
|
if item.respond_to?(:image_str)
|
||||||
|
item.image_str=is
|
||||||
|
end
|
||||||
|
|
||||||
tmp = File::join($ut_testtmp, "tmp.lyrdb")
|
tmp = File::join($ut_testtmp, "tmp.lyrdb")
|
||||||
|
|
||||||
|
|
@ -635,7 +639,9 @@ class RDB_TestClass < TestBase
|
||||||
assert_equal(ii[0].has_tag?(db2.tag_id("x1")), true)
|
assert_equal(ii[0].has_tag?(db2.tag_id("x1")), true)
|
||||||
assert_equal(ii[0].has_tag?(db2.tag_id("x")), false)
|
assert_equal(ii[0].has_tag?(db2.tag_id("x")), false)
|
||||||
# Only the first 30 bytes count ... the remaining part is too different for different versions of Qt
|
# Only the first 30 bytes count ... the remaining part is too different for different versions of Qt
|
||||||
assert_equal(ii[0].image_str[0..30], is[0..30])
|
if ii[0].respond_to?(:image_str)
|
||||||
|
assert_equal(ii[0].image_str[0..30], is[0..30])
|
||||||
|
end
|
||||||
assert_equal(db2.cell_by_id(ii[0].cell_id).qname, "cell_name")
|
assert_equal(db2.cell_by_id(ii[0].cell_id).qname, "cell_name")
|
||||||
assert_equal(db2.category_by_id(ii[0].category_id).path, "cat")
|
assert_equal(db2.category_by_id(ii[0].category_id).path, "cat")
|
||||||
vs = ""
|
vs = ""
|
||||||
|
|
@ -656,6 +662,10 @@ class RDB_TestClass < TestBase
|
||||||
# LayoutView
|
# LayoutView
|
||||||
def test_10
|
def test_10
|
||||||
|
|
||||||
|
if !RBA.constants.member?(:Application)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
mw = RBA::Application.instance.main_window
|
mw = RBA::Application.instance.main_window
|
||||||
mw.create_layout(1)
|
mw.create_layout(1)
|
||||||
view = mw.current_view
|
view = mw.current_view
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue