mirror of https://github.com/KLayout/klayout.git
Tests for new LayoutView features
This commit is contained in:
parent
585ab0f310
commit
41cbef1e5a
|
|
@ -1153,7 +1153,7 @@ Class<lay::LayoutView> decl_LayoutView (QT_EXTERNAL_BASE (QWidget) "lay", "Layou
|
|||
"The image contains the current scene (layout, annotations etc.).\n"
|
||||
"The image is drawn synchronously with the given width and height. Drawing may take some time. "
|
||||
) +
|
||||
gsi::method_ext ("get_image_with_options", &get_image_with_options, gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("linewidth"), gsi::arg ("oversampling"), gsi::arg ("resolution"), gsi::arg ("target"), gsi::arg ("monochrome"),
|
||||
gsi::method_ext ("get_image_with_options", &get_image_with_options, gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("linewidth", 0), gsi::arg ("oversampling", 0), gsi::arg ("resolution", 0.0), gsi::arg ("target", db::DBox (), "current"), gsi::arg ("monochrome", false),
|
||||
"@brief Gets the layout image as a \\QImage (with options)\n"
|
||||
"\n"
|
||||
"@param width The width of the image to render in pixel.\n"
|
||||
|
|
@ -1191,7 +1191,7 @@ Class<lay::LayoutView> decl_LayoutView (QT_EXTERNAL_BASE (QWidget) "lay", "Layou
|
|||
"\n"
|
||||
"This method has been introduced in 0.28.\n"
|
||||
) +
|
||||
gsi::method_ext ("get_pixels_with_options", &get_pixels_with_options, gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("linewidth"), gsi::arg ("oversampling"), gsi::arg ("resolution"), gsi::arg ("target"),
|
||||
gsi::method_ext ("get_pixels_with_options", &get_pixels_with_options, gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("linewidth", 0), gsi::arg ("oversampling", 0), gsi::arg ("resolution", 0.0), gsi::arg ("target", db::DBox (), "current"),
|
||||
"@brief Gets the layout image as a \\PixelBuffer (with options)\n"
|
||||
"\n"
|
||||
"@param width The width of the image to render in pixel.\n"
|
||||
|
|
@ -1206,7 +1206,7 @@ Class<lay::LayoutView> decl_LayoutView (QT_EXTERNAL_BASE (QWidget) "lay", "Layou
|
|||
"\n"
|
||||
"This method has been introduced in 0.28.\n"
|
||||
) +
|
||||
gsi::method_ext ("get_pixels_with_options_mono", &get_pixels_with_options_mono, gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("linewidth"), gsi::arg ("target"),
|
||||
gsi::method_ext ("get_pixels_with_options_mono", &get_pixels_with_options_mono, gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("linewidth", 0), gsi::arg ("target", db::DBox (), "current"),
|
||||
"@brief Gets the layout image as a \\PixelBuffer (with options)\n"
|
||||
"\n"
|
||||
"@param width The width of the image to render in pixel.\n"
|
||||
|
|
@ -1241,7 +1241,7 @@ Class<lay::LayoutView> decl_LayoutView (QT_EXTERNAL_BASE (QWidget) "lay", "Layou
|
|||
"The image is written as a PNG file to the given file. "
|
||||
"The image is drawn synchronously with the given width and height. Drawing may take some time. "
|
||||
) +
|
||||
gsi::method_ext ("save_image_with_options", &save_image_with_options, gsi::arg ("filename"), gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("linewidth"), gsi::arg ("oversampling"), gsi::arg ("resolution"), gsi::arg ("target"), gsi::arg ("monochrome"),
|
||||
gsi::method_ext ("save_image_with_options", &save_image_with_options, gsi::arg ("filename"), gsi::arg ("width"), gsi::arg ("height"), gsi::arg ("linewidth", 0), gsi::arg ("oversampling", 0), gsi::arg ("resolution", 0.0), gsi::arg ("target", db::DBox (), "current"), gsi::arg ("monochrome", false),
|
||||
"@brief Saves the layout as an image to the given file (with options)\n"
|
||||
"\n"
|
||||
"@param filename The file to which to write the screenshot to.\n"
|
||||
|
|
|
|||
|
|
@ -425,8 +425,32 @@ class LAYLayoutView_TestClass < TestBase
|
|||
|
||||
def test_4
|
||||
|
||||
# standalone view image generation
|
||||
# standalone image generation (see C++ tests)
|
||||
lv = RBA::LayoutView::new
|
||||
lv.set_config("inst-color", "#000000")
|
||||
lv.set_config("background-color", "#ffffff")
|
||||
lv.load_layout(File.join($ut_testsrc, "testdata/gds/t10.gds"), true)
|
||||
|
||||
img = lv.get_pixels_with_options(500, 500, 1, 1, 1.0, RBA::DBox::new)
|
||||
au = RBA::PixelBuffer.read_png(File.join($ut_testsrc, "testdata/lay/au_lv1.png"))
|
||||
if au
|
||||
assert_equal(au == img, true)
|
||||
end
|
||||
|
||||
lv.set_config("full-hierarchy-new-cell", "true")
|
||||
lv.load_layout(File.join($ut_testsrc, "testdata/gds/t10.gds"), false)
|
||||
|
||||
img = lv.get_pixels_with_options(500, 500, 1, 1, 1.0, RBA::DBox::new)
|
||||
au = RBA::PixelBuffer.read_png(File.join($ut_testsrc, "testdata/lay/au_lv2.png"))
|
||||
if au
|
||||
assert_equal(au == img, true)
|
||||
end
|
||||
|
||||
img = lv.get_pixels_with_options_mono(500, 500, 1, RBA::DBox::new)
|
||||
au = RBA::BitmapBuffer.read_png(File.join($ut_testsrc, "testdata/lay/au_lv3.png"))
|
||||
if au
|
||||
assert_equal(au == img, true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue