vte4 4.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ # Copyright (C) 2014-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Vte
18
+ class Loader < GObjectIntrospection::Loader
19
+ private
20
+ def pre_load(repository, namespace)
21
+ define_version_module
22
+ end
23
+
24
+ def define_version_module
25
+ @version_module = Module.new
26
+ @base_module.const_set("Version", @version_module)
27
+ end
28
+
29
+ def post_load(repository, namespace)
30
+ require_libraries
31
+ end
32
+
33
+ def require_libraries
34
+ require "vte4/pty"
35
+ require "vte4/regex"
36
+ require "vte4/terminal"
37
+ require "vte4/version"
38
+
39
+ require "vte4/deprecated"
40
+ end
41
+
42
+ def load_constant_info(info)
43
+ case info.name
44
+ when /_VERSION\z/
45
+ @version_module.const_set($PREMATCH, info.value)
46
+ else
47
+ super
48
+ end
49
+ end
50
+ end
51
+ end
data/lib/vte4/pty.rb ADDED
@@ -0,0 +1,39 @@
1
+ # Copyright (C) 2015-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Vte
18
+ class Pty
19
+ alias_method :initialize_raw, :initialize
20
+ def initialize(*args)
21
+ case args[0]
22
+ when PtyFlags
23
+ initialize_new_sync(*args)
24
+ else
25
+ initialize_raw(*args)
26
+ end
27
+ end
28
+
29
+ alias_method :size_raw, :size
30
+ def size
31
+ succeeded, rows, columns = size_raw
32
+ if succeeded
33
+ [rows, columns]
34
+ else
35
+ nil
36
+ end
37
+ end
38
+ end
39
+ end
data/lib/vte4/regex.rb ADDED
@@ -0,0 +1,44 @@
1
+ # Copyright (C) 2017-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Vte
18
+ class Regex
19
+ alias_method :initialize_raw, :initialize
20
+ def initialize(pattern, compile_flags, options)
21
+ flags = parse_compile_flags(compile_flags)
22
+ if options[:for_match]
23
+ initialize_new_for_match(pattern, pattern.bytesize, flags)
24
+ elsif options[:for_search]
25
+ initialize_new_for_search(pattern, pattern.bytesize, flags)
26
+ else
27
+ raise(ArgumentError,
28
+ "must specify usage :for_match or :for_search: #{options.inspect}")
29
+ end
30
+ end
31
+
32
+ private
33
+ def parse_compile_flags(compile_flags)
34
+ return compile_flags if compile_flags.is_a?(Integer)
35
+ return compile_flags unless compile_flags.is_a?(Array)
36
+
37
+ flags = 0
38
+ compile_flags.each do |flag|
39
+ flags |= GLib::RegexCompileFlags.new(flag).to_i
40
+ end
41
+ flags
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,38 @@
1
+ # Copyright (C) 2015-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Vte
18
+ class Terminal
19
+ def spawn(options={})
20
+ pty_flags = options[:pty_flags] || PtyFlags::DEFAULT
21
+ working_directory = options[:working_directory]
22
+ argv = options[:argv] || [ENV["SHELL"] || "/bin/sh"]
23
+ envv = options[:envv]
24
+ default_spawn_flags = GLib::Spawn::SEARCH_PATH
25
+ spawn_flags = options[:spawn_flags] || default_spawn_flags
26
+ succeeded, pid = spawn_sync(pty_flags,
27
+ working_directory,
28
+ argv,
29
+ envv,
30
+ spawn_flags)
31
+ if succeeded
32
+ pid
33
+ else
34
+ nil
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,33 @@
1
+ # Copyright (C) 2015-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Vte
18
+ module Version
19
+ STRING = [MAJOR, MINOR, MICRO].join(".")
20
+
21
+ class << self
22
+ def or_later?(major, minor, micro=nil)
23
+ micro ||= 0
24
+ version = [
25
+ MAJOR,
26
+ MINOR,
27
+ MICRO,
28
+ ]
29
+ (version <=> [major, minor, micro]) >= 0
30
+ end
31
+ end
32
+ end
33
+ end
data/lib/vte4.rb ADDED
@@ -0,0 +1,32 @@
1
+ # Copyright (C) 2014-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "gtk4"
18
+
19
+ require "vte4/loader"
20
+
21
+ module Vte
22
+ LOG_DOMAIN = "Vte"
23
+ GLib::Log.set_log_domain(LOG_DOMAIN)
24
+
25
+ class Error < StandardError
26
+ end
27
+
28
+ Gtk.init if Gtk.respond_to?(:init)
29
+ loader = Loader.new(self)
30
+ loader.version = "3.91"
31
+ loader.load("Vte")
32
+ end
data/test/run-test.rb ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2014-2023 Ruby-GNOME Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ require_relative "../../glib2/test/run-test"
20
+
21
+ run_test(__dir__,
22
+ [
23
+ "glib2",
24
+ "gobject-introspection",
25
+ "gio2",
26
+ "gdk_pixbuf2",
27
+ "atk",
28
+ "cairo-gobject",
29
+ "pango",
30
+ "gdk4",
31
+ "gtk4",
32
+ "vte4",
33
+ ]) do
34
+ require_relative "vte4-test-utils"
35
+ end
data/test/test-pty.rb ADDED
@@ -0,0 +1,46 @@
1
+ # Copyright (C) 2014-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestPty < Test::Unit::TestCase
18
+ def setup
19
+ flag = Vte::PtyFlags::DEFAULT
20
+ @pty = Vte::Pty.new(flag)
21
+ end
22
+
23
+ def test_fd
24
+ assert_nothing_raised do
25
+ @pty.fd
26
+ end
27
+ end
28
+
29
+ def test_size
30
+ original = @pty.size
31
+ begin
32
+ row = 80
33
+ col = 24
34
+ @pty.set_size(row, col)
35
+ assert_equal([row, col], @pty.size)
36
+ ensure
37
+ @pty.set_size(*original)
38
+ end
39
+ end
40
+
41
+ def test_utf8
42
+ assert_nothing_raised do
43
+ @pty.utf8 = true
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,51 @@
1
+ # Copyright (C) 2017-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestRegex < Test::Unit::TestCase
18
+ include VteTestUtils
19
+
20
+ def test_for_match
21
+ Vte::Regex.new("test", 0, for_match: true)
22
+ # TODO: Add assertion
23
+ end
24
+
25
+ def test_for_search
26
+ Vte::Regex.new("test", 0, for_search: true)
27
+ # TODO: Add assertion
28
+ end
29
+
30
+ sub_test_case("flags") do
31
+ def test_integer
32
+ Vte::Regex.new("test",
33
+ GLib::RegexCompileFlags::OPTIMIZE.to_i,
34
+ for_match: true)
35
+ # TODO: Add assertion
36
+ end
37
+
38
+ def test_object
39
+ Vte::Regex.new("test",
40
+ GLib::RegexCompileFlags::OPTIMIZE,
41
+ for_match: true)
42
+ # TODO: Add assertion
43
+ end
44
+
45
+ def test_array
46
+ flags = [:optimize, :multiline]
47
+ Vte::Regex.new("test", flags, for_match: true)
48
+ # TODO: Add assertion
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,93 @@
1
+ # Copyright (C) 2014-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestTerminalProperties < Test::Unit::TestCase
18
+ include VteTestUtils
19
+
20
+ def setup
21
+ @terminal = Vte::Terminal.new
22
+ end
23
+
24
+ def test_allow_bold
25
+ @terminal.allow_bold = false
26
+ assert_false(@terminal.allow_bold?)
27
+ end
28
+
29
+ def test_audible_bell
30
+ @terminal.audible_bell = false
31
+ assert_false(@terminal.audible_bell?)
32
+ end
33
+
34
+ def test_backspace_binding
35
+ bind = Vte::EraseBinding::DELETE_SEQUENCE
36
+ @terminal.backspace_binding = bind
37
+ assert_equal(bind, @terminal.backspace_binding)
38
+ end
39
+
40
+ def test_cursor_blink_mode
41
+ cursor_mode = Vte::CursorBlinkMode::ON
42
+ @terminal.cursor_blink_mode = cursor_mode
43
+ assert_equal(cursor_mode, @terminal.cursor_blink_mode)
44
+ end
45
+
46
+ def test_cursor_shape
47
+ shape = Vte::CursorShape::IBEAM
48
+ @terminal.cursor_shape = shape
49
+ assert_equal(shape, @terminal.cursor_shape)
50
+ end
51
+
52
+ def test_delete_binding
53
+ bind = Vte::EraseBinding::ASCII_DELETE
54
+ @terminal.delete_binding = bind
55
+ assert_equal(bind, @terminal.delete_binding)
56
+ end
57
+
58
+ def test_encoding
59
+ encoding = "UTF-16"
60
+ @terminal.encoding = encoding
61
+ assert_equal(encoding, @terminal.encoding)
62
+ end
63
+
64
+ def test_font_desc
65
+ font = Pango::FontDescription.new("Monospace 15")
66
+ @terminal.font_desc = font
67
+ assert_equal(font, @terminal.font_desc)
68
+ end
69
+
70
+ def test_pointer_autohide
71
+ hide = true
72
+ @terminal.pointer_autohide = hide
73
+ assert_true(@terminal.pointer_autohide?)
74
+ end
75
+
76
+ def test_scroll_on_keystroke
77
+ scroll = true
78
+ @terminal.scroll_on_keystroke = scroll
79
+ assert_true(@terminal.scroll_on_keystroke?)
80
+ end
81
+
82
+ def test_scroll_on_output
83
+ scroll = false
84
+ @terminal.scroll_on_output = scroll
85
+ assert_false(@terminal.scroll_on_output?)
86
+ end
87
+
88
+ def test_scrollback_lines
89
+ lines = 1024
90
+ @terminal.scrollback_lines = lines
91
+ assert_equal(lines, @terminal.scrollback_lines)
92
+ end
93
+ end
@@ -0,0 +1,67 @@
1
+ # Copyright (C) 2014-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestTerminalSignals < Test::Unit::TestCase
18
+ def setup
19
+ if Vte::Version.or_later?(0, 64)
20
+ omit("VTE 0.64 or later doesn't work in Docker by default")
21
+ # /usr/include/c++/11/bits/shared_ptr_base.h:976: std::__shared_ptr_access<
22
+ # _Tp,
23
+ # _Lp,
24
+ # <anonymous>,
25
+ # <anonymous>
26
+ # >::element_type&
27
+ # std::__shared_ptr_access<
28
+ # _Tp,
29
+ # _Lp,
30
+ # <anonymous>,
31
+ # <anonymous>
32
+ # >::operator*() const [
33
+ # with
34
+ # _Tp = vte::platform::Clipboard;
35
+ # __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic;
36
+ # bool <anonymous> = false;
37
+ # bool <anonymous> = false;
38
+ # std::__shared_ptr_access<
39
+ # _Tp,
40
+ # _Lp,
41
+ # <anonymous>,
42
+ # <anonymous>
43
+ # >::element_type = vte::platform::Clipboard
44
+ #]: Assertion '_M_get() != nullptr' failed.
45
+ end
46
+
47
+ @terminal = Vte::Terminal.new
48
+ end
49
+
50
+ def test_copy_clipboard_signal
51
+ called = false
52
+ @terminal.signal_connect("copy-clipboard") do
53
+ called = true
54
+ end
55
+ @terminal.signal_emit("copy-clipboard")
56
+ assert_true(called)
57
+ end
58
+
59
+ def test_paste_clipboard_signal
60
+ called = false
61
+ @terminal.signal_connect("paste-clipboard") do
62
+ called = true
63
+ end
64
+ @terminal.signal_emit("paste-clipboard")
65
+ assert_true(called)
66
+ end
67
+ end
@@ -0,0 +1,76 @@
1
+ # Copyright (C) 2014-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestTerminal < Test::Unit::TestCase
18
+ include VteTestUtils
19
+
20
+ def setup
21
+ @terminal = Vte::Terminal.new
22
+ end
23
+
24
+ def test_font
25
+ font = Pango::FontDescription.new("Monospace 16")
26
+ @terminal.font = font
27
+ assert_equal(font, @terminal.font)
28
+ end
29
+
30
+ sub_test_case "#spawn" do
31
+ setup do
32
+ @loop = GLib::MainLoop.new
33
+ @wait_child_exited = false
34
+ @child_exit_callback_id = @terminal.signal_connect("child-exited") do
35
+ @loop.quit
36
+ end
37
+
38
+ if Vte::Version.or_later?(0, 64)
39
+ omit("VTE 0.64 or later doesn't work in Docker by default")
40
+ # Fedora Rawhide test in Docker reports:
41
+ # Failed to fdwalk: Operation not permitted
42
+ # not NotFound.
43
+ #
44
+ # The following discussions may be related:
45
+ # https://github.com/mviereck/x11docker/issues/346
46
+ # https://github.com/containers/podman/issues/10130
47
+ end
48
+ end
49
+
50
+ teardown do
51
+ unless @wait_child_exited
52
+ GLib::Idle.add do
53
+ @loop.quit
54
+ GLib::Source::REMOVE
55
+ end
56
+ end
57
+ @loop.run
58
+ @terminal.signal_handler_disconnect(@child_exit_callback_id)
59
+ end
60
+
61
+ test "success" do
62
+ pid = @terminal.spawn(:argv => ["echo"])
63
+ @wait_child_exited = true
64
+ assert do
65
+ pid > 0
66
+ end
67
+ end
68
+
69
+ test "failure" do
70
+ assert_raise(Gio::IOError::NotFound) do
71
+ @terminal.spawn(:argv => ["/bin/nonexistent"])
72
+ @wait_child_exited = true
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,53 @@
1
+ # Copyright (C) 2015-2023 Ruby-GNOME Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestVteVersion < Test::Unit::TestCase
18
+ include VteTestUtils
19
+
20
+ test "STRING" do
21
+ major = Vte::Version::MAJOR
22
+ minor = Vte::Version::MINOR
23
+ micro = Vte::Version::MICRO
24
+ assert_equal([major, minor, micro].join("."),
25
+ Vte::Version::STRING)
26
+ end
27
+
28
+ sub_test_case("#or_later?") do
29
+ test "same" do
30
+ assert do
31
+ Vte::Version.or_later?(Vte::Version::MAJOR,
32
+ Vte::Version::MINOR,
33
+ Vte::Version::MICRO)
34
+ end
35
+ end
36
+
37
+ test "later" do
38
+ assert do
39
+ Vte::Version.or_later?(Vte::Version::MAJOR,
40
+ Vte::Version::MINOR - 1,
41
+ Vte::Version::MICRO)
42
+ end
43
+ end
44
+
45
+ test "earlier" do
46
+ assert do
47
+ not Vte::Version.or_later?(Vte::Version::MAJOR,
48
+ Vte::Version::MINOR + 1,
49
+ Vte::Version::MICRO)
50
+ end
51
+ end
52
+ end
53
+ end