rsvg2 2.2.4-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +7 -0
  2. data/README +35 -0
  3. data/Rakefile +69 -0
  4. data/ext/rsvg2/depend +6 -0
  5. data/ext/rsvg2/extconf.rb +89 -0
  6. data/ext/rsvg2/rbrsvg.c +206 -0
  7. data/ext/rsvg2/rbrsvgdimensiondata.c +194 -0
  8. data/ext/rsvg2/rbrsvghandle.c +496 -0
  9. data/ext/rsvg2/rsvg2.def +2 -0
  10. data/ext/rsvg2/rsvg2.h +70 -0
  11. data/extconf.rb +49 -0
  12. data/lib/2.0/rsvg2.so +0 -0
  13. data/lib/2.1/rsvg2.so +0 -0
  14. data/lib/2.2/rsvg2.so +0 -0
  15. data/lib/rsvg2.rb +33 -0
  16. data/sample/svg-viewer.rb +44 -0
  17. data/sample/svg2.rb +60 -0
  18. data/test/rsvg2-test-utils.rb +23 -0
  19. data/test/run-test.rb +49 -0
  20. data/test/test-handle.rb +91 -0
  21. data/vendor/local/bin/croco-0.6-config +87 -0
  22. data/vendor/local/bin/csslint-0.6.exe +0 -0
  23. data/vendor/local/bin/libcroco-0.6-3.dll +0 -0
  24. data/vendor/local/bin/librsvg-2-2.dll +0 -0
  25. data/vendor/local/bin/rsvg-convert.exe +0 -0
  26. data/vendor/local/include/libcroco-0.6/libcroco/cr-additional-sel.h +98 -0
  27. data/vendor/local/include/libcroco-0.6/libcroco/cr-attr-sel.h +74 -0
  28. data/vendor/local/include/libcroco-0.6/libcroco/cr-cascade.h +74 -0
  29. data/vendor/local/include/libcroco-0.6/libcroco/cr-declaration.h +136 -0
  30. data/vendor/local/include/libcroco-0.6/libcroco/cr-doc-handler.h +298 -0
  31. data/vendor/local/include/libcroco-0.6/libcroco/cr-enc-handler.h +94 -0
  32. data/vendor/local/include/libcroco-0.6/libcroco/cr-fonts.h +315 -0
  33. data/vendor/local/include/libcroco-0.6/libcroco/cr-input.h +174 -0
  34. data/vendor/local/include/libcroco-0.6/libcroco/cr-num.h +127 -0
  35. data/vendor/local/include/libcroco-0.6/libcroco/cr-om-parser.h +98 -0
  36. data/vendor/local/include/libcroco-0.6/libcroco/cr-parser.h +128 -0
  37. data/vendor/local/include/libcroco-0.6/libcroco/cr-parsing-location.h +70 -0
  38. data/vendor/local/include/libcroco-0.6/libcroco/cr-prop-list.h +80 -0
  39. data/vendor/local/include/libcroco-0.6/libcroco/cr-pseudo.h +64 -0
  40. data/vendor/local/include/libcroco-0.6/libcroco/cr-rgb.h +94 -0
  41. data/vendor/local/include/libcroco-0.6/libcroco/cr-sel-eng.h +110 -0
  42. data/vendor/local/include/libcroco-0.6/libcroco/cr-selector.h +95 -0
  43. data/vendor/local/include/libcroco-0.6/libcroco/cr-simple-sel.h +130 -0
  44. data/vendor/local/include/libcroco-0.6/libcroco/cr-statement.h +440 -0
  45. data/vendor/local/include/libcroco-0.6/libcroco/cr-string.h +76 -0
  46. data/vendor/local/include/libcroco-0.6/libcroco/cr-style.h +339 -0
  47. data/vendor/local/include/libcroco-0.6/libcroco/cr-stylesheet.h +102 -0
  48. data/vendor/local/include/libcroco-0.6/libcroco/cr-term.h +190 -0
  49. data/vendor/local/include/libcroco-0.6/libcroco/cr-tknzr.h +115 -0
  50. data/vendor/local/include/libcroco-0.6/libcroco/cr-token.h +212 -0
  51. data/vendor/local/include/libcroco-0.6/libcroco/cr-utils.h +246 -0
  52. data/vendor/local/include/libcroco-0.6/libcroco/libcroco-config.h +17 -0
  53. data/vendor/local/include/libcroco-0.6/libcroco/libcroco.h +44 -0
  54. data/vendor/local/include/librsvg-2.0/librsvg/librsvg-enum-types.h +24 -0
  55. data/vendor/local/include/librsvg-2.0/librsvg/librsvg-features.h +28 -0
  56. data/vendor/local/include/librsvg-2.0/librsvg/rsvg-cairo.h +42 -0
  57. data/vendor/local/include/librsvg-2.0/librsvg/rsvg.h +264 -0
  58. data/vendor/local/lib/girepository-1.0/Rsvg-2.0.typelib +0 -0
  59. data/vendor/local/lib/libcroco-0.6.a +0 -0
  60. data/vendor/local/lib/libcroco-0.6.dll.a +0 -0
  61. data/vendor/local/lib/libcroco-0.6.la +41 -0
  62. data/vendor/local/lib/librsvg-2.a +0 -0
  63. data/vendor/local/lib/librsvg-2.dll.a +0 -0
  64. data/vendor/local/lib/librsvg-2.la +41 -0
  65. data/vendor/local/lib/pkgconfig/libcroco-0.6.pc +11 -0
  66. data/vendor/local/lib/pkgconfig/librsvg-2.0.pc +15 -0
  67. data/vendor/local/share/gir-1.0/Rsvg-2.0.gir +754 -0
  68. data/vendor/local/share/gtk-doc/html/libcroco/ch01.html +113 -0
  69. data/vendor/local/share/gtk-doc/html/libcroco/home.png +0 -0
  70. data/vendor/local/share/gtk-doc/html/libcroco/index.html +109 -0
  71. data/vendor/local/share/gtk-doc/html/libcroco/index.sgml +582 -0
  72. data/vendor/local/share/gtk-doc/html/libcroco/left.png +0 -0
  73. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-additional-sel.html +337 -0
  74. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-attr-sel.html +203 -0
  75. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-cascade.html +240 -0
  76. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-declaration.html +642 -0
  77. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-doc-handler.html +517 -0
  78. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-enc-handler.html +164 -0
  79. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-fonts.html +670 -0
  80. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-input.html +1102 -0
  81. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-num.html +265 -0
  82. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-om-parser.html +380 -0
  83. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-parser.html +913 -0
  84. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-parsing-location.html +205 -0
  85. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-prop-list.html +421 -0
  86. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-pseudo.html +141 -0
  87. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-rgb.html +503 -0
  88. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-sel-eng.html +346 -0
  89. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-selector.html +246 -0
  90. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-simple-sel.html +240 -0
  91. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-statement.html +1408 -0
  92. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-string.html +137 -0
  93. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-style.html +384 -0
  94. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-stylesheet.html +158 -0
  95. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-term.html +304 -0
  96. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-tknzr.html +312 -0
  97. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-token.html +428 -0
  98. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-cr-utils.html +334 -0
  99. data/vendor/local/share/gtk-doc/html/libcroco/libcroco-libcroco-config.html +80 -0
  100. data/vendor/local/share/gtk-doc/html/libcroco/libcroco.devhelp2 +511 -0
  101. data/vendor/local/share/gtk-doc/html/libcroco/right.png +0 -0
  102. data/vendor/local/share/gtk-doc/html/libcroco/style.css +266 -0
  103. data/vendor/local/share/gtk-doc/html/libcroco/up.png +0 -0
  104. data/vendor/local/share/gtk-doc/html/rsvg-2.0/RsvgHandle.html +1420 -0
  105. data/vendor/local/share/gtk-doc/html/rsvg-2.0/annotation-glossary.html +55 -0
  106. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-14.html +55 -0
  107. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-22.html +43 -0
  108. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-32.html +47 -0
  109. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-36.html +46 -0
  110. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-4.html +39 -0
  111. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-8.html +54 -0
  112. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-2-9.html +53 -0
  113. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-deprecated.html +100 -0
  114. data/vendor/local/share/gtk-doc/html/rsvg-2.0/api-index-full.html +323 -0
  115. data/vendor/local/share/gtk-doc/html/rsvg-2.0/home.png +0 -0
  116. data/vendor/local/share/gtk-doc/html/rsvg-2.0/index.html +88 -0
  117. data/vendor/local/share/gtk-doc/html/rsvg-2.0/index.sgml +106 -0
  118. data/vendor/local/share/gtk-doc/html/rsvg-2.0/left-insensitive.png +0 -0
  119. data/vendor/local/share/gtk-doc/html/rsvg-2.0/left.png +0 -0
  120. data/vendor/local/share/gtk-doc/html/rsvg-2.0/licence.html +57 -0
  121. data/vendor/local/share/gtk-doc/html/rsvg-2.0/object-tree.html +38 -0
  122. data/vendor/local/share/gtk-doc/html/rsvg-2.0/right-insensitive.png +0 -0
  123. data/vendor/local/share/gtk-doc/html/rsvg-2.0/right.png +0 -0
  124. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-2.0.devhelp2 +94 -0
  125. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-GIO.html +360 -0
  126. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-GdkPixbuf.html +484 -0
  127. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Using-RSVG-with-cairo.html +154 -0
  128. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg-Version-check-and-feature-tests.html +142 -0
  129. data/vendor/local/share/gtk-doc/html/rsvg-2.0/rsvg.html +57 -0
  130. data/vendor/local/share/gtk-doc/html/rsvg-2.0/style.css +476 -0
  131. data/vendor/local/share/gtk-doc/html/rsvg-2.0/up-insensitive.png +0 -0
  132. data/vendor/local/share/gtk-doc/html/rsvg-2.0/up.png +0 -0
  133. data/vendor/local/share/license/libcroco/AUTHORS +13 -0
  134. data/vendor/local/share/license/libcroco/COPYING +481 -0
  135. data/vendor/local/share/license/libcroco/COPYING.LIB +481 -0
  136. data/vendor/local/share/license/librsvg/AUTHORS +1 -0
  137. data/vendor/local/share/license/librsvg/COPYING +340 -0
  138. data/vendor/local/share/license/librsvg/COPYING.LIB +482 -0
  139. data/vendor/local/share/man/man1/rsvg-convert.1 +55 -0
  140. metadata +209 -0
@@ -0,0 +1,2 @@
1
+ EXPORTS
2
+ Init_rsvg2
@@ -0,0 +1,70 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2005-2006 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2004 Kouhei Sutou <kou@cozmixng.org>
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
21
+ */
22
+
23
+ #ifndef RSVG2_H
24
+ #define RSVG2_H
25
+
26
+ #ifdef __cplusplus
27
+ extern "C" {
28
+ #endif /* __cplusplus */
29
+
30
+ #include <ruby.h>
31
+
32
+ #include <rbglib.h>
33
+ #include <rbgobject.h>
34
+
35
+ #ifdef HAVE_LIBRSVG_RSVG_GZ_H
36
+ # include <librsvg/rsvg-gz.h>
37
+ #else
38
+ # include <librsvg/rsvg.h>
39
+ #endif
40
+
41
+ #ifdef HAVE_RB_CAIRO_H
42
+ # include <rb_cairo.h>
43
+ # include <librsvg/rsvg-cairo.h>
44
+ #endif
45
+
46
+ #ifdef HAVE_LIBRSVG_LIBRSVG_ENUM_TYPES_H
47
+ # include <librsvg/librsvg-enum-types.h>
48
+ #else
49
+ # include "librsvg-enum-types.h"
50
+ #endif
51
+
52
+ #define LIBRSVG_CHECK_VERSION(major, minor, micro) \
53
+ (LIBRSVG_MAJOR_VERSION > (major) || \
54
+ (LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION > (minor)) || \
55
+ (LIBRSVG_MAJOR_VERSION == (major) && LIBRSVG_MINOR_VERSION == (minor) && \
56
+ LIBRSVG_MICRO_VERSION >= (micro)))
57
+
58
+ #if !LIBRSVG_CHECK_VERSION(2, 36, 2)
59
+ # include <librsvg/librsvg-features.h>
60
+ #endif
61
+
62
+
63
+ G_GNUC_INTERNAL void Init_rsvg_handle(VALUE mRSVG);
64
+ G_GNUC_INTERNAL void Init_rsvg_dimensiondata(VALUE mRSVG);
65
+
66
+ #ifdef __cplusplus
67
+ }
68
+ #endif
69
+
70
+ #endif
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'mkmf'
5
+ require 'rbconfig'
6
+ require 'fileutils'
7
+
8
+ package = "rsvg2"
9
+
10
+ base_dir = Pathname(__FILE__).dirname.expand_path
11
+ ext_dir = base_dir + "ext" + package
12
+ mkmf_gnome2_dir = base_dir + 'lib'
13
+
14
+ ruby = File.join(RbConfig::CONFIG['bindir'],
15
+ RbConfig::CONFIG['ruby_install_name'] +
16
+ RbConfig::CONFIG["EXEEXT"])
17
+
18
+ build_dir = Pathname("ext") + package
19
+ FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
20
+ extconf_rb_path = ext_dir + "extconf.rb"
21
+ system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false)
22
+
23
+ create_makefile(package)
24
+ FileUtils.mv("Makefile", "Makefile.lib")
25
+
26
+ File.open("Makefile", "w") do |makefile|
27
+ makefile.puts(<<-EOM)
28
+ all:
29
+ (cd ext/#{package} && $(MAKE))
30
+ $(MAKE) -f Makefile.lib
31
+
32
+ install:
33
+ (cd ext/#{package} && $(MAKE) install)
34
+ $(MAKE) -f Makefile.lib install
35
+
36
+ site-install:
37
+ (cd ext/#{package} && $(MAKE) site-install)
38
+ $(MAKE) -f Makefile.lib site-install
39
+
40
+ clean:
41
+ (cd ext/#{package} && $(MAKE) clean)
42
+ $(MAKE) -f Makefile.lib clean
43
+
44
+ distclean:
45
+ (cd ext/#{package} && $(MAKE) distclean)
46
+ $(MAKE) -f Makefile.lib distclean
47
+ @rm -f Makefile.lib
48
+ EOM
49
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1,33 @@
1
+ require "glib2"
2
+ require "gdk_pixbuf2"
3
+ begin
4
+ require "cairo"
5
+ rescue LoadError
6
+ end
7
+
8
+ base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
9
+ vendor_dir = base_dir + "vendor" + "local"
10
+ vendor_bin_dir = vendor_dir + "bin"
11
+ GLib.prepend_dll_path(vendor_bin_dir)
12
+ begin
13
+ major, minor, micro, = RUBY_VERSION.split(/\./)
14
+ require "#{major}.#{minor}/rsvg2.so"
15
+ rescue LoadError
16
+ require "rsvg2.so"
17
+ end
18
+
19
+ module RSVG
20
+ LOG_DOMAIN = "librsvg"
21
+ end
22
+
23
+ if RSVG.cairo_available?
24
+ module Cairo
25
+ class Context
26
+ def render_rsvg_handle(handle, *args, &block)
27
+ handle.render_cairo(self, *args, &block)
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ GLib::Log.set_log_domain(RSVG::LOG_DOMAIN)
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gtk2'
4
+ require 'rsvg2'
5
+
6
+ unless RSVG.cairo_available?
7
+ puts "this sample needs RSVG with cairo support"
8
+ exit(-1)
9
+ end
10
+
11
+ unless Gdk.cairo_available?
12
+ puts "this sample needs GDK with cairo support"
13
+ exit(-1)
14
+ end
15
+
16
+ if ARGV.size != 1
17
+ puts "usage: #{$0} input.svg"
18
+ exit(-1)
19
+ end
20
+
21
+ input = ARGV.shift
22
+
23
+ handle = RSVG::Handle.new_from_file(input)
24
+ width, height = handle.dimensions.to_a
25
+
26
+ window = Gtk::Window.new
27
+ window.set_default_size(width, height)
28
+ area = Gtk::DrawingArea.new
29
+
30
+ window.signal_connect("destroy") do
31
+ Gtk.main_quit
32
+ end
33
+
34
+ area.signal_connect("expose_event") do |widget, event|
35
+ context = widget.window.create_cairo_context
36
+ window_width, window_height = widget.window.size
37
+ context.scale(window_width.to_f / width, window_height.to_f / height)
38
+ context.render_rsvg_handle(handle)
39
+ end
40
+
41
+ window.add(area)
42
+ window.show_all
43
+
44
+ Gtk.main
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ svg2.rb - Ruby/RSVG sample script.
4
+
5
+ Copyright (c) 2006 Ruby-GNOME2 Project Team
6
+ This program is licenced under the same licence as Ruby-GNOME2.
7
+
8
+ $Id: svg2.rb,v 1.5 2006/06/17 13:30:25 mutoh Exp $
9
+ =end
10
+
11
+ require 'tempfile'
12
+ require "rsvg2"
13
+
14
+ if ARGV.size < 2
15
+ puts "usage: #{$0} input.svg output [scale_ratio]"
16
+ exit(-1)
17
+ end
18
+
19
+ input, output, ratio = ARGV
20
+ ratio ||= 1.0
21
+ ratio = ratio.to_f
22
+
23
+ output_type = File.extname(output)[1..-1].downcase
24
+ output_type = "jpeg" if /jpg/ =~ output_type
25
+
26
+ def to_pixbuf_with_cairo(input, ratio)
27
+ handle = nil
28
+ Dir.chdir(File.dirname(File.expand_path(input))) do
29
+ handle = RSVG::Handle.new_from_file(input)
30
+ end
31
+ dim = handle.dimensions
32
+ width = dim.width * ratio
33
+ height = dim.height * ratio
34
+ surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, width, height)
35
+ cr = Cairo::Context.new(surface)
36
+ cr.scale(ratio, ratio)
37
+ cr.render_rsvg_handle(handle)
38
+ temp = Tempfile.new("svg2")
39
+ cr.target.write_to_png(temp.path)
40
+ cr.target.finish
41
+ Gdk::Pixbuf.new(temp.path)
42
+ end
43
+
44
+ def to_pixbuf(input, ratio)
45
+ RSVG.pixbuf_from_file_at_zoom(input, ratio, ratio)
46
+ end
47
+
48
+ if RSVG.cairo_available?
49
+ puts "using cairo..."
50
+ pixbuf = to_pixbuf_with_cairo(input, ratio)
51
+ else
52
+ pixbuf = to_pixbuf(input, ratio)
53
+ end
54
+
55
+ if pixbuf.nil?
56
+ puts "Is it a SVG file?: #{input}"
57
+ exit(-1)
58
+ end
59
+ puts "saving to #{output}(#{pixbuf.width}x#{pixbuf.height})..."
60
+ pixbuf.save(output, output_type)
@@ -0,0 +1,23 @@
1
+ # Copyright (C) 2014 Ruby-GNOME2 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 "test-unit"
18
+ require "test/unit/notify"
19
+
20
+ require "fileutils"
21
+
22
+ module RSVG2TestUtils
23
+ end
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2014 Ruby-GNOME2 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
+ ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
20
+ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
21
+
22
+ glib_base = File.join(ruby_gnome2_base, "glib2")
23
+ gdk_pixbuf2_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
24
+ rsvg2_base = File.join(ruby_gnome2_base, "rsvg2")
25
+
26
+ have_make = system("which make > /dev/null")
27
+
28
+ modules = [
29
+ [glib_base, "glib2"],
30
+ [gdk_pixbuf2_base, "gdk_pixbuf2"],
31
+ [rsvg2_base, "rsvg2"],
32
+ ]
33
+ modules.each do |target, module_name|
34
+ if File.exist?(File.join(target, "Makefile")) and have_make
35
+ `make -C #{target.dump} > /dev/null` or exit(false)
36
+ end
37
+ $LOAD_PATH.unshift(File.join(target, "ext", module_name))
38
+ $LOAD_PATH.unshift(File.join(target, "lib"))
39
+ end
40
+
41
+ $LOAD_PATH.unshift(File.join(glib_base, "test"))
42
+ require "glib-test-init"
43
+
44
+ $LOAD_PATH.unshift(File.join(rsvg2_base, "test"))
45
+ require "rsvg2-test-utils"
46
+
47
+ require "rsvg2"
48
+
49
+ exit Test::Unit::AutoRunner.run(true)
@@ -0,0 +1,91 @@
1
+ # Copyright (C) 2014 Ruby-GNOME2 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 TestHandle < Test::Unit::TestCase
18
+ sub_test_case ".new_from_file" do
19
+ sub_test_case "options" do
20
+ def setup
21
+ setup_svg
22
+ end
23
+
24
+ def setup_svg
25
+ @svg_path = "tmp/empty.svg"
26
+ return if File.exist?(@svg_path)
27
+
28
+ FileUtils.mkdir_p(File.dirname(@svg_path))
29
+ File.open(@svg_path, "w") do |svg|
30
+ svg.puts(<<-SVG)
31
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
32
+ <svg>
33
+ </svg>
34
+ SVG
35
+ end
36
+ end
37
+
38
+ def test_empty_options
39
+ handle = RSVG::Handle.new_from_file(@svg_path, {})
40
+ assert_equal([0, 0, 0.0, 0.0],
41
+ handle.dimensions.to_a)
42
+ end
43
+ end
44
+
45
+ sub_test_case ":flags => :unlimited" do
46
+ def setup
47
+ setup_large_svg
48
+ end
49
+
50
+ def setup_large_svg
51
+ @large_svg_path = "tmp/large-file.svg"
52
+ return if File.exist?(@large_svg_path)
53
+
54
+ FileUtils.mkdir_p(File.dirname(@large_svg_path))
55
+ large_byte = (10 * 1024 * 1024).to_i
56
+ File.open(@large_svg_path, "w") do |svg|
57
+ svg.puts(<<-SVG_HEADER)
58
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
59
+ <svg>
60
+ SVG_HEADER
61
+ large_byte.times do
62
+ svg.puts("\n")
63
+ end
64
+ svg.puts(<<-SVG_FOOTER)
65
+ </svg>
66
+ SVG_FOOTER
67
+ end
68
+ end
69
+
70
+ def test_no_option
71
+ assert_raise(RSVG::Error::Failed) do
72
+ RSVG::Handle.new_from_file(@large_svg_path)
73
+ end
74
+ end
75
+
76
+ def test_unlimited
77
+ handle = RSVG::Handle.new_from_file(@large_svg_path,
78
+ :flags => :flag_unlimited)
79
+ assert_equal([0, 0, 0.0, 0.0],
80
+ handle.dimensions.to_a)
81
+ end
82
+
83
+ def test_base_uri
84
+ handle = RSVG::Handle.new
85
+ uri_string = "test_base_uri"
86
+ handle.base_uri = uri_string
87
+ assert_match(uri_string, handle.base_uri)
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,87 @@
1
+ #! /bin/sh
2
+
3
+ prefix=/home/vagrant/ruby-gnome2.win64/rsvg2/vendor/local
4
+ exec_prefix=${prefix}
5
+ exec_prefix_set=no
6
+ includedir=${prefix}/include
7
+ libdir=${exec_prefix}/lib
8
+
9
+ usage()
10
+ {
11
+ cat <<EOF
12
+ Usage: croco-config [OPTION]...
13
+
14
+ Known values for OPTION are:
15
+
16
+ --prefix=DIR change CROCO prefix [default $prefix]
17
+ --exec-prefix=DIR change CROCO executable prefix [default $exec_prefix]
18
+ --libs print library linking information
19
+ --cflags print pre-processor and compiler flags
20
+ --help display this help and exit
21
+ --version output version information
22
+ EOF
23
+
24
+ exit $1
25
+ }
26
+
27
+ if test $# -eq 0; then
28
+ usage 1
29
+ fi
30
+
31
+ cflags=false
32
+ libs=false
33
+
34
+ while test $# -gt 0; do
35
+ case "$1" in
36
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
37
+ *) optarg= ;;
38
+ esac
39
+
40
+ case "$1" in
41
+ --prefix=*)
42
+ prefix=$optarg
43
+ if test $exec_prefix_set = no ; then
44
+ exec_prefix=$optarg
45
+ fi
46
+ ;;
47
+
48
+ --prefix)
49
+ echo $prefix
50
+ ;;
51
+
52
+ --exec-prefix=*)
53
+ exec_prefix=$optarg
54
+ exec_prefix_set=yes
55
+ ;;
56
+
57
+ --exec-prefix)
58
+ echo $exec_prefix
59
+ ;;
60
+
61
+ --version)
62
+ echo 0.6.8
63
+ exit 0
64
+ ;;
65
+
66
+ --help)
67
+ usage 0
68
+ ;;
69
+
70
+ --cflags)
71
+ echo -mms-bitfields -I/home/vagrant/ruby-gnome2.win64/glib2/vendor/local/include -I/home/vagrant/ruby-gnome2.win64/glib2/vendor/local/include/glib-2.0 -I/home/vagrant/ruby-gnome2.win64/glib2/vendor/local/lib/glib-2.0/include -I/home/vagrant/rcairo.win64/vendor/local/include/libxml2 @GLIB2_CFLAGS@ @LIBXML2_CFLAGS@
72
+ ;;
73
+
74
+ --libs)
75
+ echo -L/home/vagrant/ruby-gnome2.win64/glib2/vendor/local/lib -L/home/vagrant/rcairo.win64/vendor/local/lib -lglib-2.0 -lintl -lxml2 @GLIB2_LIBS@ @LIBXML2_LIBS@
76
+ ;;
77
+
78
+ *)
79
+ usage
80
+ exit 1
81
+ ;;
82
+ esac
83
+ shift
84
+ done
85
+
86
+
87
+ exit 0