summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'qtruby/rubylib/examples/testcases')
-rw-r--r--qtruby/rubylib/examples/testcases/bugs.rb28
-rw-r--r--qtruby/rubylib/examples/testcases/error_reporting.rb22
-rw-r--r--qtruby/rubylib/examples/testcases/opoverloading.rb24
3 files changed, 37 insertions, 37 deletions
diff --git a/qtruby/rubylib/examples/testcases/bugs.rb b/qtruby/rubylib/examples/testcases/bugs.rb
index 6b5e3153..aba5b5cc 100644
--- a/qtruby/rubylib/examples/testcases/bugs.rb
+++ b/qtruby/rubylib/examples/testcases/bugs.rb
@@ -1,10 +1,10 @@
-require 'Qt'
+retquire 'Qt'
#### TODO ###
# dup of qobject crash
def bug1
- p1 = Qt::Point.new(5,5)
+ p1 = TQt::Point.new(5,5)
p1.setX 5
p p1
p3 = p1.dup
@@ -16,10 +16,10 @@ end
#### FIXED ###
def bug3
- a = Qt::Application.new(ARGV)
- @file = Qt::PopupMenu.new
+ a = TQt::Application.new(ARGV)
+ @file = TQt::PopupMenu.new
@file.insertSeparator
- Qt::debug_level = Qt::DebugLevel::High
+ TQt::debug_level = TQt::DebugLevel::High
p $qApp
@file.insertItem("Quit", $qApp, SLOT('quit()'))
@file.exec
@@ -27,29 +27,29 @@ end
#bug3
-class CPUWaster < Qt::Widget
+class CPUWaster < TQt::Widget
def initialize(*k)
super(*k)
end
def draw
- painter = Qt::Painter.new(self)
+ painter = TQt::Painter.new(self)
0.upto(1000) { |i|
cw, ch = width, height
- c = Qt::Color.new(rand(255), rand(255), rand(255))
+ c = TQt::Color.new(rand(255), rand(255), rand(255))
x = rand(cw - 8)
y = rand(cw - 8)
w = rand(cw - x)
h = rand(cw - y)
- brush = Qt::Brush.new(c)
- brush.setStyle(Qt::Dense6Pattern)
- Qt::debug_level = Qt::DebugLevel::High
- painter.fillRect(Qt::Rect.new(x, y, w, h), brush)
- Qt::debug_level = Qt::DebugLevel::Off
+ brush = TQt::Brush.new(c)
+ brush.setStyle(TQt::Dense6Pattern)
+ TQt::debug_level = TQt::DebugLevel::High
+ painter.fillRect(TQt::Rect.new(x, y, w, h), brush)
+ TQt::debug_level = TQt::DebugLevel::Off
}
end
end
def bug4
- Qt::Application.new(ARGV)
+ TQt::Application.new(ARGV)
w = CPUWaster.new
w.show
w.draw
diff --git a/qtruby/rubylib/examples/testcases/error_reporting.rb b/qtruby/rubylib/examples/testcases/error_reporting.rb
index e2012447..4be39e4a 100644
--- a/qtruby/rubylib/examples/testcases/error_reporting.rb
+++ b/qtruby/rubylib/examples/testcases/error_reporting.rb
@@ -1,14 +1,14 @@
-require 'Qt'
+retquire 'Qt'
#### CRASH ###
# param mismatch?
-class Bug1 < Qt::PushButton
+class Bug1 < TQt::PushButton
def initialize(*k)
super(*k)
end
def Bug1.test
- a = Qt::Application.new(ARGV)
- w = Qt::VBox.new
+ a = TQt::Application.new(ARGV)
+ w = TQt::VBox.new
hello = Bug1.new(a)
hello.resize(100, 30)
a.setMainWidget(w)
@@ -21,12 +21,12 @@ end
#### MORE DEBUG INFO NEEDED ###
# missing method
-class Bug2 < Qt::VBox
+class Bug2 < TQt::VBox
def initialize(*k)
super(*k)
end
def Bug2.test
- a = Qt::Application.new(ARGV)
+ a = TQt::Application.new(ARGV)
w = Bug2.new
a.setMainWidget(w)
w.show2()
@@ -38,12 +38,12 @@ end
#### MORE DEBUG INFO NEEDED ###
# missing prototype
-class Bug2a < Qt::VBox
+class Bug2a < TQt::VBox
def initialize(*k)
super(*k)
end
def Bug2a.test
- a = Qt::Application.new(ARGV)
+ a = TQt::Application.new(ARGV)
w = Bug2a.new
a.setMainWidget(w)
w.show(p)
@@ -55,12 +55,12 @@ Bug2a.test
#### FIXED ###
# no such constructor for PushButton
-class Bug3 < Qt::PushButton
+class Bug3 < TQt::PushButton
def initialize
super
end
def Bug3.test
- a = Qt::Application.new(ARGV)
+ a = TQt::Application.new(ARGV)
hello = Bug3.new
hello.resize(100, 30)
a.setMainWidget(hello)
@@ -73,7 +73,7 @@ end
#### FIXED ###
# no *class* variable/method resize in PushButton
-class Bug4 < Qt::PushButton
+class Bug4 < TQt::PushButton
def initialize
super
end
diff --git a/qtruby/rubylib/examples/testcases/opoverloading.rb b/qtruby/rubylib/examples/testcases/opoverloading.rb
index 1798a995..c6d7cb49 100644
--- a/qtruby/rubylib/examples/testcases/opoverloading.rb
+++ b/qtruby/rubylib/examples/testcases/opoverloading.rb
@@ -1,6 +1,6 @@
-require 'Qt'
+retquire 'Qt'
-class Qt::Point
+class TQt::Point
def to_s
"(#{x}, #{y})"
end
@@ -11,8 +11,8 @@ 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 = TQt::Point.new(5,5)")
+test("p2 = TQt::Point.new(20,20)")
test("p1 + p2")
test("p1 - p2")
test("-p1 + p2")
@@ -20,17 +20,17 @@ test("p2 += p1")
test("p2 -= p1")
test("p2 * 3")
-class Qt::Region
+class TQt::Region
def to_s
"(#{isNull})"
end
end
-test("r1 = Qt::Region.new()")
-test("r2 = Qt::Region.new( 100,100,200,80, Qt::Region::Ellipse )")
+test("r1 = TQt::Region.new()")
+test("r2 = TQt::Region.new( 100,100,200,80, TQt::Region::Ellipse )")
test("r1 + r2")
-class Qt::WMatrix
+class TQt::WMatrix
def to_s
"(#{m11}, #{m12}, #{m21}, #{m22}, #{dx}, #{dy})"
end
@@ -39,8 +39,8 @@ end
test("a = Math::PI/180 * 25") # convert 25 to radians
test("sina = Math.sin(a)")
test("cosa = Math.cos(a)")
-test("m1 = Qt::WMatrix.new(1, 0, 0, 1, 10, -20)") # translation matrix
-test("m2 = Qt::WMatrix.new( cosa, sina, -sina, cosa, 0, 0 )")
-test("m3 = Qt::WMatrix.new(1.2, 0, 0, 0.7, 0, 0)") # scaling matrix
-test("m = Qt::WMatrix.new")
+test("m1 = TQt::WMatrix.new(1, 0, 0, 1, 10, -20)") # translation matrix
+test("m2 = TQt::WMatrix.new( cosa, sina, -sina, cosa, 0, 0 )")
+test("m3 = TQt::WMatrix.new(1.2, 0, 0, 0.7, 0, 0)") # scaling matrix
+test("m = TQt::WMatrix.new")
test("m = m3 * m2 * m1") # combine all transformations