test/helper.rb in processing-0.5.32 vs test/helper.rb in processing-0.5.33
- old
+ new
@@ -32,12 +32,14 @@
def mkdir(dir: nil, filename: nil)
path = dir || File.dirname(filename)
FileUtils.mkdir_p path unless File.exist? path
end
-def test_label(index = 1)
- caller_locations[index].then {|loc| "#{loc.label}_#{loc.lineno}"}
+def test_label(frame_offset = 1, suffix: nil)
+ suffix = suffix ? "_#{suffix}" : ''
+ caller_locations[frame_offset]
+ .then {|loc| "#{loc.label}_#{loc.lineno}#{suffix}"}
end
def temp_path(ext: nil, &block)
f = Tempfile.new
path = f.path
@@ -68,9 +70,10 @@
end
end
def test_draw(*sources, width: 1000, height: 1000, pixelDensity: 1, label: nil)
graphics(width, height, pixelDensity).tap do |g|
+ g.renderMode :p5js
g.beginDraw {g.instance_eval sources.compact.join("\n")}
g.save draw_output_path(label, *sources) if label
end
end