WIP: fixed unit tests for Qt-less build.

This commit is contained in:
Matthias Koefferlein
2018-07-10 01:17:35 +02:00
parent 58fd6ed143
commit d2c890ab6d
21 changed files with 585 additions and 458 deletions
+12
View File
@@ -155,6 +155,10 @@ class Ant_TestClass < TestBase
# Annotation object
def test_1
if !RBA.constants.member?(:Application)
return
end
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" )
@@ -387,6 +391,10 @@ class Ant_TestClass < TestBase
# Test LayoutView integration
def test_2
if !RBA.constants.member?(:Application)
return
end
mw = RBA::Application::instance.main_window
mw.close_all
mw.create_layout( 0 )
@@ -459,6 +467,10 @@ class Ant_TestClass < TestBase
# Test LayoutView integration with live updates
def test_3
if !RBA.constants.member?(:Application)
return
end
mw = RBA::Application::instance.main_window
mw.close_all
mw.create_layout( 0 )
+181 -161
View File
@@ -86,15 +86,17 @@ class Basic_TestClass < TestBase
assert_equal( a.a3("a"), 1 )
assert_equal( a.a3("ab"), 2 )
assert_equal( a.a3("µ"), 2 ) # two UTF8 bytes
assert_equal( a.a3_qstr("a"), 1 )
assert_equal( a.a3_qstr("ab"), 2 )
assert_equal( a.a3_qstr("µ"), 1 ) # one UTF8 character
assert_equal( a.a3_qstrref("a"), 1 )
assert_equal( a.a3_qstrref("ab"), 2 )
assert_equal( a.a3_qstrref("µ"), 1 ) # one UTF8 character
assert_equal( a.a3_qba("a"), 1 )
assert_equal( a.a3_qba("ab"), 2 )
assert_equal( a.a3_qba("µ"), 2 ) # two UTF8 bytes
if a.respond_to?(:a3_qstr)
assert_equal( a.a3_qstr("a"), 1 )
assert_equal( a.a3_qstr("ab"), 2 )
assert_equal( a.a3_qstr("µ"), 1 ) # one UTF8 character
assert_equal( a.a3_qstrref("a"), 1 )
assert_equal( a.a3_qstrref("ab"), 2 )
assert_equal( a.a3_qstrref("µ"), 1 ) # one UTF8 character
assert_equal( a.a3_qba("a"), 1 )
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.a4([1]), 1.0 )
@@ -176,111 +178,115 @@ class Basic_TestClass < TestBase
assert_equal( eb < eb, false )
assert_equal( ea < eb, true )
eea = RBA::Enums::new
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)" )
if RBA.constants.member?(:Enums)
assert_equal( a.get_e.to_s, "#0" )
a.set_e( RBA::Enum::a )
assert_equal( a.get_e.to_s, "a" )
a.set_e( RBA::Enum::b )
assert_equal( a.get_e.to_s, "b" )
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" )
eea = RBA::Enums::new
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)" )
ee = RBA::Enum::new
assert_equal( ee.to_s, "#0" )
a.mod_eref( ee, RBA::Enum::c )
assert_equal( ee.to_s, "c" )
a.mod_eptr( ee, RBA::Enum::a )
assert_equal( ee.to_s, "a" )
assert_equal( a.get_e.to_s, "#0" )
a.set_e( RBA::Enum::a )
assert_equal( a.get_e.to_s, "a" )
a.set_e( RBA::Enum::b )
assert_equal( a.get_e.to_s, "b" )
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, "[]" )
a.push_ev( RBA::Enum::a )
a.push_ev( RBA::Enum::new )
a.push_ev( RBA::Enum::b )
assert_equal( a.ev.inspect, "[a (1), (not a valid enum value), b (2)]" )
ee = RBA::Enum::new
assert_equal( ee.to_s, "#0" )
a.mod_eref( ee, RBA::Enum::c )
assert_equal( ee.to_s, "c" )
a.mod_eptr( ee, RBA::Enum::a )
assert_equal( ee.to_s, "a" )
assert_equal( a.get_ef.inspect, " (0)" )
a.set_ef( RBA::Enum::a )
assert_equal( a.get_ef.to_s, "a" )
a.set_ef( RBA::Enums::new(RBA::Enum::b) )
assert_equal( a.get_ef.to_s, "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)" )
assert_equal( a.ev.inspect, "[]" )
a.push_ev( RBA::Enum::a )
a.push_ev( RBA::Enum::new )
a.push_ev( RBA::Enum::b )
assert_equal( a.ev.inspect, "[a (1), (not a valid enum value), b (2)]" )
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" )
assert_equal( a.get_ef.inspect, " (0)" )
a.set_ef( RBA::Enum::a )
assert_equal( a.get_ef.to_s, "a" )
a.set_ef( RBA::Enums::new(RBA::Enum::b) )
assert_equal( a.get_ef.to_s, "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
@@ -303,9 +309,11 @@ class Basic_TestClass < TestBase
assert_equal( a3.a1, -11 )
assert_equal( a1.a10_d(5.2), "5.2" )
assert_equal( a1.a10_d_qstr(5.25), "5.25" )
assert_equal( a1.a10_d_qstrref(5.2), "5.2" )
assert_equal( a1.a10_d_qba(5.1), "5.1" )
if a1.respond_to?(:a10_d_qstr)
assert_equal( a1.a10_d_qstr(5.25), "5.25" )
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" )
x = RBA::Value.new(1.5)
assert_equal( x.value.to_s, "1.5" )
@@ -2212,61 +2220,65 @@ class Basic_TestClass < TestBase
b.set_ss([])
assert_equal(b.ss, [])
v = [ "a", "b" ]
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, [])
if b.respond_to?(:set_qls)
v = [ "a", 1 ]
RBA::B::push_qlv(v, 2.5)
assert_equal(v, [ "a", 1, 2.5 ])
b.set_qlv([ 17, "1" ])
assert_equal(b.qlv, [ 17, "1" ])
b.set_qlv([])
assert_equal(b.qlv, [])
v = [ "a", "b" ]
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", "b" ]
RBA::B::push_qsl(v, "x")
assert_equal(v, [ "a", "b", "x" ])
b.set_qsl([ "1" ])
assert_equal(b.qsl, [ "1" ])
b.set_qsl([])
assert_equal(b.qsl, [])
v = [ "a", 1 ]
RBA::B::push_qlv(v, 2.5)
assert_equal(v, [ "a", 1, 2.5 ])
b.set_qlv([ 17, "1" ])
assert_equal(b.qlv, [ 17, "1" ])
b.set_qlv([])
assert_equal(b.qlv, [])
v = [ "a", "b" ]
RBA::B::push_qvs(v, "x")
assert_equal(v, [ "a", "b", "x" ])
b.set_qvs([ "1" ])
assert_equal(b.qvs, [ "1" ])
b.set_qvs([])
assert_equal(b.qvs, [])
v = [ "a", "b" ]
RBA::B::push_qsl(v, "x")
assert_equal(v, [ "a", "b", "x" ])
b.set_qsl([ "1" ])
assert_equal(b.qsl, [ "1" ])
b.set_qsl([])
assert_equal(b.qsl, [])
v = [ "a", "b" ]
RBA::B::push_qss(v, "x")
assert_equal(v.sort, [ "a", "b", "x" ])
b.set_qss([ "1" ])
assert_equal(b.qss, [ "1" ])
b.set_qss([])
assert_equal(b.qss, [])
v = [ "a", "b" ]
RBA::B::push_qvs(v, "x")
assert_equal(v, [ "a", "b", "x" ])
b.set_qvs([ "1" ])
assert_equal(b.qvs, [ "1" ])
b.set_qvs([])
assert_equal(b.qvs, [])
v = { 1 => "a", 17 => "b" }
RBA::B::insert_qmap_is(v, 2, "x")
assert_equal(v, { 1 => "a", 17 => "b", 2 => "x" })
b.set_qmap_is({ 1 => "t", 17 => "b" })
assert_equal(b.qmap_is, { 1 => "t", 17 => "b" })
b.set_qmap_is({})
assert_equal(b.qmap_is, {})
v = [ "a", "b" ]
RBA::B::push_qss(v, "x")
assert_equal(v.sort, [ "a", "b", "x" ])
b.set_qss([ "1" ])
assert_equal(b.qss, [ "1" ])
b.set_qss([])
assert_equal(b.qss, [])
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, {})
v = { 1 => "a", 17 => "b" }
RBA::B::insert_qmap_is(v, 2, "x")
assert_equal(v, { 1 => "a", 17 => "b", 2 => "x" })
b.set_qmap_is({ 1 => "t", 17 => "b" })
assert_equal(b.qmap_is, { 1 => "t", 17 => "b" })
b.set_qmap_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
@@ -2290,6 +2302,10 @@ class Basic_TestClass < TestBase
end
def test_60
if !RBA.constants.member?(:SQ)
return
end
sq = RBA::SQ::new
@@ -2353,6 +2369,10 @@ class Basic_TestClass < TestBase
def test_61
if !RBA.constants.member?(:SQ)
return
end
sq = RBA::SQ::new
got_s0a = 0
+4
View File
@@ -29,6 +29,10 @@ class DBGlyph_TestClass < TestBase
def test_1_Glyph
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.description, "Non-manhattan (0.6 x 0.8 um cell)")
assert_equal(tg.width.to_s, "600")
+5 -25
View File
@@ -29,11 +29,7 @@ class DBInstance_TestClass < TestBase
def test_1_InstEdit
# this only works in editable mode
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@@ -224,11 +220,7 @@ class DBInstance_TestClass < TestBase
def test_2_InstEdit
# this only works in editable mode
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@@ -435,11 +427,7 @@ class DBInstance_TestClass < TestBase
def test_4_InstFlatten
# this only works in editable mode
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@@ -502,11 +490,7 @@ class DBInstance_TestClass < TestBase
def test_5_InstEdit_Double
# this only works in editable mode
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@@ -697,11 +681,7 @@ class DBInstance_TestClass < TestBase
def test_6_InstEdit_Double
# this only works in editable mode
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
+1 -1
View File
@@ -1044,7 +1044,7 @@ END
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.
if RBA::Application::instance.is_editable?
if lll.is_editable?
assert_equal(m.has_undo?, true)
assert_equal(m.has_redo?, false)
+57 -49
View File
@@ -97,67 +97,71 @@ class PCellTestLib < RBA::Library
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))
param("width", BoxPCell2::TypeDouble, "Width", :default => 1.0)
param("height", BoxPCell2::TypeDouble, "Height", :default => 1.0)
super()
end
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 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
def produce_impl
# create the shape
cell.shapes(l).insert(RBA::Box::new(-w / 2, -h / 2, w / 2, h / 2))
# 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
class PCellTestLib2 < RBA::Library
def initialize
def can_create_from_shape_impl
return self.shape.is_box?
end
# set the description
description = "PCell test lib2"
# create the PCell declarations
layout.register_pcell("Box2", BoxPCell2::new)
def transformation_from_shape_impl
return RBA::Trans::new(shape.box.center - RBA::Point::new)
end
# register us with the name "MyLib"
self.register("PCellTestLib2")
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
if !RBA.constants.member?(:PCellDeclarationHelper)
return
end
# instantiate and register the library
tl = PCellTestLib2::new
+4 -20
View File
@@ -592,11 +592,7 @@ class DBShapes_TestClass < TestBase
# Shapes (edit)
def test_7_LayoutEdit
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@@ -741,11 +737,7 @@ class DBShapes_TestClass < TestBase
# Shapes (edit, new methods)
def test_7_LayoutEdit2
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@@ -951,11 +943,7 @@ class DBShapes_TestClass < TestBase
# Shapes (edit, new methods)
def test_7_DLayoutEdit2
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
@@ -1161,11 +1149,7 @@ class DBShapes_TestClass < TestBase
# Shapes (edit, new methods)
def test_7_LayoutEdit3
if ! RBA::Application::instance.is_editable?
return
end
ly = RBA::Layout::new
ly = RBA::Layout::new(true)
ci1 = ly.add_cell( "c1" )
ci2 = ly.add_cell( "c2" )
+4
View File
@@ -252,6 +252,10 @@ END
def test_7
if !RBA.constants.member?(:Image)
return
end
rin = RBA::Region::new
rin.insert(RBA::Box::new(0, 0, 100, 200))
rin.insert(RBA::Box::new(9900, 9800, 10000, 10000))
+8
View File
@@ -28,6 +28,10 @@ class EDT_TestClass < TestBase
# ObjectInstPath
def test_1
if !RBA.constants.member?(:ObjectInstPath)
return
end
ly = RBA::Layout::new
li = ly.insert_layer(RBA::LayerInfo::new(1, 0))
tc = ly.create_cell("TOP")
@@ -110,6 +114,10 @@ class EDT_TestClass < TestBase
# Selection
def test_2
if !RBA.constants.member?(:Application)
return
end
mw = RBA::Application::instance.main_window
mw.close_all
mw.create_layout( 0 )
+16
View File
@@ -27,6 +27,10 @@ class IMG_TestClass < TestBase
def test_1
if !RBA.constants.member?(:ImageDataMapping)
return
end
dm = RBA::ImageDataMapping.new
dm.gamma = 0.5
assert_equal(dm.gamma, 0.5)
@@ -62,6 +66,10 @@ class IMG_TestClass < TestBase
def test_2
if !RBA.constants.member?(:Image)
return
end
image = RBA::Image.new
assert_equal(image.to_s, "empty:")
assert_equal(image.is_empty?, true)
@@ -181,6 +189,10 @@ class IMG_TestClass < TestBase
def test_3
if !RBA.constants.member?(:Image)
return
end
# compatibility with 0.21
d = []
20000.times { d.push(0.0) }
@@ -197,6 +209,10 @@ class IMG_TestClass < TestBase
def test_4
if !RBA.constants.member?(:Application)
return
end
mw = RBA::Application.instance.main_window
mw.close_all
mw.create_layout(0)
+28
View File
@@ -61,6 +61,10 @@ class LAYLayers_TestClass < TestBase
def test_1
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
@@ -213,6 +217,10 @@ class LAYLayers_TestClass < TestBase
def test_1a
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
@@ -424,6 +432,10 @@ class LAYLayers_TestClass < TestBase
def test_2
if !RBA.constants.member?(:Application)
return
end
p = RBA::LayerPropertiesNode::new
assert_equal( p.source( false ), "*/*@*" )
@@ -667,6 +679,10 @@ class LAYLayers_TestClass < TestBase
# direct replacement of objects and attributes
def test_3
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
@@ -749,6 +765,10 @@ class LAYLayers_TestClass < TestBase
# propagation of "real" attributes through the hierarchy
def test_4
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
@@ -786,6 +806,10 @@ class LAYLayers_TestClass < TestBase
# delete method of iterator
def test_5
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
@@ -830,6 +854,10 @@ class LAYLayers_TestClass < TestBase
# custom stipples and line styles
def test_6
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
+8
View File
@@ -39,6 +39,10 @@ class LAYLayoutView_TestClass < TestBase
# Basic view creation and MainWindow events
def test_1
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
@@ -122,6 +126,10 @@ class LAYLayoutView_TestClass < TestBase
def test_2
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
+4
View File
@@ -27,6 +27,10 @@ class LAYMarkers_TestClass < TestBase
def test_1
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.create_layout(0)
+26 -10
View File
@@ -27,6 +27,10 @@ class LAYMenuTest_TestClass < TestBase
def test_0
if !RBA.constants.member?(:Action)
return
end
a = RBA::Action::new
b = a.dup
@@ -94,6 +98,10 @@ class LAYMenuTest_TestClass < TestBase
def test_1
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
menu = mw.menu
@@ -261,21 +269,29 @@ RESULT
end
class MenuHandler < RBA::Action
def initialize( t, k, &action )
self.title = t
self.shortcut = k
@action = action
if RBA.constants.member?(:Action)
class MenuHandler < RBA::Action
def initialize( t, k, &action )
self.title = t
self.shortcut = k
@action = action
end
def triggered
@action.call( self )
end
private
@action
end
def triggered
@action.call( self )
end
private
@action
end
def test_2
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
menu = mw.menu
+4
View File
@@ -45,6 +45,10 @@ class LAYSession_TestClass < TestBase
def test_1
if !RBA.constants.member?(:Application)
return
end
app = RBA::Application.instance
mw = app.main_window
mw.close_all
+16 -6
View File
@@ -422,10 +422,12 @@ class RDB_TestClass < TestBase
assert_equal(item.has_tag?(db.tag_id("x1")), false)
assert_equal(item.tags_str, "")
is="iVBORw0KGgoAAAANSUhEUgAAACoAAAA0CAIAAABzfT3nAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAA3UlEQVRYhe2WwQ3DIAxFoco8XaGZIaeO43FyYgZYgYXcQ6SWuDGgBhWq/qccIvGCEd9SbAwAAPSGaW2lFR2rfWDpXrPpSe2SP10fvnn/PZHZH9IwbKFVZZ/Z6wMtZcjW02Bn2FVpZYdWdkr2nvh23S2FyDNJuVITpwmRjTGbNr0v20U5byNtJuuJt/fO2f93+UlbEJl5UjVPr3Y71EQ/PoPPlU+lDJtWlCt3GwCMG33BuJGAcWMEMG6c1jBudCyf/nzV8nbZPRohclFLHdGbZ8eNSjN1fmf0AACA1jwA4hKxu4C6P7EAAAAASUVORK5CYII="
item.image_str=is
# 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])
if item.respond_to?(:image_str)
is="iVBORw0KGgoAAAANSUhEUgAAACoAAAA0CAIAAABzfT3nAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA0SAAANOgHo3ZneAAAA3UlEQVRYhe2WwQ3DIAxFoco8XaGZIaeO43FyYgZYgYXcQ6SWuDGgBhWq/qccIvGCEd9SbAwAAPSGaW2lFR2rfWDpXrPpSe2SP10fvnn/PZHZH9IwbKFVZZ/Z6wMtZcjW02Bn2FVpZYdWdkr2nvh23S2FyDNJuVITpwmRjTGbNr0v20U5byNtJuuJt/fO2f93+UlbEJl5UjVPr3Y71EQ/PoPPlU+lDJtWlCt3GwCMG33BuJGAcWMEMG6c1jBudCyf/nzV8nbZPRohclFLHdGbZ8eNSjN1fmf0AACA1jwA4hKxu4C6P7EAAAAASUVORK5CYII="
item.image_str=is
# 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")
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.user_tag_id("x2"))
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")
@@ -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("x")), false)
# 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.category_by_id(ii[0].category_id).path, "cat")
vs = ""
@@ -656,6 +662,10 @@ class RDB_TestClass < TestBase
# LayoutView
def test_10
if !RBA.constants.member?(:Application)
return
end
mw = RBA::Application.instance.main_window
mw.create_layout(1)
view = mw.current_view