Skip to content

Commit 24d57f7

Browse files
committed
add Terminal#test and ::test to allow users see capabilities of different terminals (such as png, pngcairo, svg, qt etc)
1 parent 05a89fa commit 24d57f7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/gnuplotrb/staff/terminal.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ def close_arg(stream)
1717
stream.puts 'exit'
1818
Process.waitpid(stream.pid)
1919
end
20+
21+
##
22+
# Plot test page for given term_name into file
23+
# with file_name (optional).
24+
#
25+
# Test page contains possibilities of the term.
26+
def test(term_name, file_name = nil)
27+
Terminal.new.set(term: term_name).test(file_name)
28+
end
2029
end
2130

2231
##
@@ -164,5 +173,16 @@ def close
164173
check_errors
165174
Terminal.close_arg(@in)
166175
end
176+
177+
178+
##
179+
# Plot test page into file with file_name (optional).
180+
#
181+
# Test page contains possibilities of the term.
182+
def test(file_name = nil)
183+
set(output: file_name) if file_name
184+
stream_puts('test')
185+
unset(:output)
186+
end
167187
end
168188
end

0 commit comments

Comments
 (0)