Sha256: 60a40d46e39b72d4471719cb73aad1666c09ab09c88a6d0aba5b787e8d768c06

Contents?: true

Size: 1007 Bytes

Versions: 20

Compression:

Stored size: 1007 Bytes

Contents

require 'Qt'

class Qt::Point
   def to_s
      "(#{x}, #{y})"
   end
end

$t = binding
def test(str)
   puts "#{str.ljust 25} => #{eval(str, $t)}"
end

test("p1 = Qt::Point.new(5,5)")
test("p2 = Qt::Point.new(20,20)")
test("p1 + p2")
test("p1 - p2")
test("-p1 + p2")
test("p2 += p1")
test("p2 -= p1")
test("p2 * 3")

class Qt::Region
   def to_s
      "(#{empty?})"
   end
end

test("r1 = Qt::Region.new()")
test("r2 = Qt::Region.new( 100,100,200,80, Qt::Region::Ellipse )")
test("r1 + r2")

class Qt::WMatrix
   def to_s
      "(#{m11}, #{m12}, #{m21}, #{m22}, #{dx}, #{dy})"
   end
end

test("a    = Math::PI/180 * 25")         # convert 25 to radians
test("sina = Math.sin(a)")
test("cosa = Math.cos(a)")
test("m1 = Qt::Matrix.new(1, 0, 0, 1, 10, -20)")  # translation matrix
test("m2 = Qt::Matrix.new( cosa, sina, -sina, cosa, 0, 0 )")
test("m3 = Qt::Matrix.new(1.2, 0, 0, 0.7, 0, 0)") # scaling matrix
test("m = Qt::Matrix.new")
test("m = m3 * m2 * m1")                  # combine all transformations

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
rock-qtbindings-4.8.6.5 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.6.5 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.6.4 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.6.2 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.6.1 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.6.0 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.5.2 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.5.1 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.5.0 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.3.0-x86-mingw32 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.8.3.0 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.4-x86-mingw32 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.4 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.3 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.2-x86-mingw32 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.2 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.1 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.1-x86-mingw32 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.0 ext/ruby/qtruby/test/opoverloading.rb
qtbindings-4.6.3.0-x86-mingw32 ext/ruby/qtruby/test/opoverloading.rb