mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-29 01:14:35 +02:00
Merge branch 'master' into wip
This commit is contained in:
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
source $drc_test_source
|
||||
target $drc_test_target
|
||||
|
||||
if $drc_test_deep
|
||||
deep
|
||||
end
|
||||
|
||||
deep
|
||||
|
||||
metal2_drawn = polygons(36, 0)
|
||||
metal2_slot = polygons(36, 3)
|
||||
|
||||
metal2_drawn.output(36, 0)
|
||||
metal2_slot.output(36, 3)
|
||||
|
||||
violations_enclosed = metal2_slot.drc(enclosed(metal2_drawn) < 10.um)
|
||||
violations_enclosed.output(100, 0)
|
||||
|
||||
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+6
-1
@@ -53,13 +53,18 @@ class DBShapesTest(unittest.TestCase):
|
||||
# Issue #2012 (reference count)
|
||||
def test_2(self):
|
||||
|
||||
# an empty dict provides the normal reference count
|
||||
obj = {}
|
||||
rc = sys.getrefcount(obj)
|
||||
|
||||
ly = pya.Layout()
|
||||
self.assertEqual(sys.getrefcount(ly), rc)
|
||||
top = ly.create_cell("TOP")
|
||||
l1 = ly.layer(1, 0)
|
||||
top.shapes(l1).insert(pya.Box(0, 0, 100, 200))
|
||||
|
||||
shapes = top.shapes(l1)
|
||||
self.assertEqual(sys.getrefcount(shapes), 2)
|
||||
self.assertEqual(sys.getrefcount(shapes), rc)
|
||||
|
||||
# Tests the ability to take PolygonWithProperties instead of base class
|
||||
# for setter
|
||||
|
||||
Vendored
+25
@@ -57,6 +57,31 @@ class LAYPixelBufferTests(unittest.TestCase):
|
||||
pb_copy = pya.PixelBuffer.read_png(tmp)
|
||||
self.assertEqual(compare(pb, pb_copy), True)
|
||||
|
||||
def test_2(self):
|
||||
|
||||
# to_bytes / from_bytes round-trip
|
||||
|
||||
import struct
|
||||
|
||||
pb = pya.PixelBuffer(10, 20)
|
||||
pb.transparent = True
|
||||
pb.fill(0xf0010203)
|
||||
pb.set_pixel(1, 2, 0x80102030)
|
||||
|
||||
data = bytes(pb.to_bytes())
|
||||
self.assertEqual(len(data), 8 + 10 * 20 * 4)
|
||||
self.assertEqual(struct.unpack("=II", data[0:8]), (10, 20)) # width, height header
|
||||
|
||||
self.assertEqual(pb == pya.PixelBuffer.from_bytes(data), True)
|
||||
|
||||
# a mismatched stream is rejected
|
||||
with self.assertRaises(Exception):
|
||||
pya.PixelBuffer.from_bytes(data[:-4])
|
||||
|
||||
# a header beyond the 64k x 64k limit is rejected
|
||||
with self.assertRaises(Exception):
|
||||
pya.PixelBuffer.from_bytes(struct.pack("=II", 65537, 1))
|
||||
|
||||
|
||||
# run unit tests
|
||||
if __name__ == '__main__':
|
||||
|
||||
Vendored
+35
@@ -152,6 +152,41 @@ class LAYPixelBuffer_TestClass < TestBase
|
||||
|
||||
end
|
||||
|
||||
def test_5
|
||||
|
||||
# to_bytes / from_bytes round-trip
|
||||
|
||||
pb = RBA::PixelBuffer::new(10, 20)
|
||||
pb.transparent = true
|
||||
pb.fill(0xf0010203)
|
||||
pb.set_pixel(1, 2, 0x80102030)
|
||||
|
||||
bytes = pb.to_bytes
|
||||
assert_equal(bytes.size, 8 + 10 * 20 * 4)
|
||||
assert_equal(bytes[0, 8].unpack("VV"), [ 10, 20 ]) # width, height header
|
||||
|
||||
assert_equal(pb == RBA::PixelBuffer.from_bytes(bytes), true)
|
||||
|
||||
# a mismatched stream is rejected
|
||||
error = false
|
||||
begin
|
||||
RBA::PixelBuffer.from_bytes(bytes[0, bytes.size - 4])
|
||||
rescue
|
||||
error = true
|
||||
end
|
||||
assert_equal(error, true)
|
||||
|
||||
# a header beyond the 64k x 64k limit is rejected
|
||||
error = false
|
||||
begin
|
||||
RBA::PixelBuffer.from_bytes([ 65537, 1 ].pack("VV"))
|
||||
rescue
|
||||
error = true
|
||||
end
|
||||
assert_equal(error, true)
|
||||
|
||||
end
|
||||
|
||||
def test_11
|
||||
|
||||
pb = RBA::BitmapBuffer::new
|
||||
|
||||
Reference in New Issue
Block a user