Sha256: 89f8d72cf7f71b129956fdda58decb70b84af983c9a973ef00b142eae9b25df6

Contents?: true

Size: 1.71 KB

Versions: 36

Compression:

Stored size: 1.71 KB

Contents

# Copyright (C) 2011-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 "tempfile"
require "fileutils"

require "gtk3"
Gtk.init

module GtkTestUtils
  private
  def only_gtk_version(major, minor, micro=nil)
    micro ||= 0
    unless Gtk::Version.or_later?(major, minor, micro)
      omit("Require GTK+ >= #{major}.#{minor}.#{micro}")
    end
  end

  def window_system_type_name
    Gdk::Screen.default.class.gtype.name
  end

  module WindowSystemTypeNames
    X11 = "GdkX11Screen"
    WINDOWS = "GdkWin32Screen"
  end

  def x11?
    window_system_type_name == WindowSystemTypeNames::X11
  end

  def csd_supported?
    screen = Gdk::Screen.default
    case window_system_type_name
    when WindowSystemTypeNames::X11
      screen.composited? and screen.rgba_visual
    when WindowSystemTypeNames::WINDOWS
      screen.rgba_visual
    else
      true
    end
  end

  def fixture_path(*components)
    File.expand_path(File.join(*components),
                     ENV["GTK3_FIXTURE_DIR"] || File.join("test", "fixture"))
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
gtk3-4.2.7 test/gtk-test-utils.rb
gtk3-4.2.6 test/gtk-test-utils.rb
gtk3-4.2.5 test/gtk-test-utils.rb
gtk3-4.2.4 test/gtk-test-utils.rb
gtk3-4.2.3 test/gtk-test-utils.rb
gtk3-4.2.2 test/gtk-test-utils.rb
gtk3-4.2.1 test/gtk-test-utils.rb
gtk3-4.2.0 test/gtk-test-utils.rb
gtk3-4.1.9 test/gtk-test-utils.rb
gtk3-4.1.8 test/gtk-test-utils.rb
gtk3-4.1.7 test/gtk-test-utils.rb
gtk3-4.1.6 test/gtk-test-utils.rb
gtk3-4.1.5 test/gtk-test-utils.rb
gtk3-4.1.4 test/gtk-test-utils.rb
gtk3-4.1.3 test/gtk-test-utils.rb
gtk3-4.1.2 test/gtk-test-utils.rb
gtk3-4.1.1 test/gtk-test-utils.rb
gtk3-4.1.0 test/gtk-test-utils.rb
gtk3-4.0.9 test/gtk-test-utils.rb
gtk3-4.0.8 test/gtk-test-utils.rb