Skip to content

Commit

Permalink
Generate gresource automaticaly for Gtk::Builder tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cedlemo committed May 23, 2015
1 parent cc9f149 commit 1df3765
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,6 +15,7 @@ Makefile.lib
/gio2/test/fixture/resource/ruby-gio2.gresource
/gtk2/ext/gtk2/rbgdkkeysyms.h
/gdk3/ext/gdk3/rbgdkkeysyms.h
/gtk3/test/fixture/simple_window.gresource
/gtksourceview2/ext/gtksourceview2/rbgtksourceview2version.h
/gtksourceview3/ext/gtksourceview3/rbgtksourceview3version.h
/goocanvas/ext/goocanvas/rbgoo_canvasversion.h
Expand Down
31 changes: 31 additions & 0 deletions gtk3/test/fixture/Rakefile
@@ -0,0 +1,31 @@
# -*- ruby -*-
#
# Copyright (C) 2015 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

require "rake/clean"

gresource = "simple_window.gresource"
gresource_xml = "#{gresource}.xml"

dependencies = [gresource_xml]

CLEAN << gresource
file gresource => dependencies do
sh("glib-compile-resources", gresource_xml)
end

task :default => gresource
Binary file removed gtk3/test/fixture/simple_window.gresource
Binary file not shown.
4 changes: 4 additions & 0 deletions gtk3/test/run-test.rb
Expand Up @@ -49,6 +49,10 @@
$LOAD_PATH.unshift(File.join(target, "lib"))
end

Dir.chdir(File.join(gtk3_base, "test", "fixture")) do
system("rake") or exit(false)
end

$LOAD_PATH.unshift(File.join(glib_base, "test"))
require 'glib-test-init'

Expand Down
2 changes: 0 additions & 2 deletions gtk3/test/test-gtk-builder.rb
Expand Up @@ -21,8 +21,6 @@ def test_constants

test "resource" do
only_gtk_version(3, 10, 0)
# TODO: Generate gresource automatically instead of adding it into
# repository.
resource = Gio::Resource.load(fixture_path("simple_window.gresource"))
Gio::Resources.register(resource)
begin
Expand Down

0 comments on commit 1df3765

Please sign in to comment.