Thread: [Fxruby-commits] CVS: FXRuby/tests TC_FXDCWindow.rb,NONE,1.1
Status: Inactive
Brought to you by:
lyle
|
From: Lyle J. <ly...@us...> - 2002-04-03 18:59:33
|
Update of /cvsroot/fxruby/FXRuby/tests
In directory usw-pr-cvs1:/tmp/cvs-serv11404
Added Files:
TC_FXDCWindow.rb
Log Message:
Added a test case (unfinished) for FXDC.
--- NEW FILE: TC_FXDCWindow.rb ---
require 'test/unit'
require 'fox'
include Fox
class TC_FXDCWindow < Test::Unit::TestCase
def set_up
if FXApp.instance.nil?
@app = FXApp.new('TC_FXDCWindow', 'FXRuby')
@app.init([])
@mainwin = FXMainWindow.new(@app, 'TC_FXDCWindow')
else
@app = FXApp.instance
@mainwin = @app.mainWindow
end
end
def testGetApp
app = @dc.app
assert_not_nil(app)
assert_kind_of?(FX_App, app)
end
def testReadPixel
p = @dc.readPixel(x, y)
end
def testDrawPoint
@dc.drawPoint(x, y)
end
def testDrawPoints
p1 = FXPoint.new
p2 = FXPoint.new
@dc.drawPoints([p1, p2])
end
def testDrawPointsRel
p1 = FXPoint.new
p2 = FXPoint.new
@dc.drawPointsRel([p1, p2])
end
def testDrawLine
@dc.drawLine(x1, y1, x2, y2)
end
def testDrawLines
@dc.drawLines(points)
end
def testDrawLinesRel
@dc.drawLinesRel(points)
end
def testDrawLineSegments
@dc.drawLineSegments(segments)
end
def testDrawArc
@dc.drawArc(x, y, w, h, ang1, ang2)
end
def testDrawArcs
@dc.drawArcs(arcs)
end
def testFillRectangle
@dc.fillRectangle(x, y, w, h)
end
def testFillRectangles(rectangles)
@dc.fillRectangles(rectangles)
end
def testFillArc
@dc.fillArc(x, y, w, h, ang1, ang2)
end
def testFillArcs
@dc.fillArcs(arcs)
end
def testFillPolygon
@dc.fillPolygon(points)
end
def testFillConcavePolygon
@dc.fillConcavePolygon(points)
end
def testFillComplexPolygon
@dc.fillComplexPolygon(points)
end
def testFillPolygonRel
@dc.fillPolygonRel(points)
end
def testFillConcavePolygonRel
@dc.fillConcavePolygonRel(points)
end
def testFillComplexPolygonRel
@dc.fillComplexPolygonRel(points)
end
def testDrawHashBox
@dc.drawHashBox(x, y, w, h)
@dc.drawHashBox(x, y, w, h, b)
end
def testDrawFocusRectangle
@dc.drawFocusRectangle(x, y, w, h)
end
def testDrawArea
@dc.drawArea(source, sx, sy, sw, sh, dx, dy)
end
def testDrawImage
@dc.drawImage(image, dx, dy)
end
def testDrawBitmap
@dc.drawBitmap(bitmap, dx, dy)
end
def testDrawIcon
@dc.drawIcon(icon, dx, dy)
end
def testDrawIconSunken
@dc.drawIconSunken(icon, dx, dy)
end
def testDrawIconShaded
@dc.drawIconShaded(icon, dx, dy)
end
def testDrawText
@dc.drawText(x, y, str)
end
def testDrawImageText
@dc.drawImageText(x, y, str)
end
def testForeground
@dc.setForeground(fg)
@dc.foreground = fg
assert_equal(fg, @dc.foreground)
assert_equal(fg, @dc.getForeground)
end
def testBackground
@dc.setBackground(fg)
@dc.background = bg
assert_equal(bg, @dc.background)
assert_equal(bg, @dc.getBackground)
end
def testDashes
@dc.setDashPattern(dashoffset, dashpattern, dashlength)
@dc.dashPattern
@dc.dashOffset
@dc.dashLength
end
def testLineWidth
@dc.setLineWidth(linewidth)
@dc.lineWidth = linewidth
assert_equal(linewidth, @dc.lineWidth)
assert_equal(linewidth, @dc.getLineWidth())
end
def testLineCap
@dc.setLineCap(lineCap)
@dc.lineCap = lineCap
assert_equal(lineCap, @dc.lineCap)
assert_equal(lineCap, @dc.getLineCap())
end
def testLineJoin
@dc.setLineJoin(lineJoin)
@dc.lineJoin = lineJoin
assert_equal(lineJoin, @dc.lineJoin)
assert_equal(lineJoin, @dc.getLineJoin())
end
def testLineStyle
@dc.setLineStyle(lineStyle)
@dc.lineStyle = lineStyle
assert_equal(lineStyle, @dc.lineStyle)
assert_equal(lineStyle, @dc.getLineStyle())
end
def testFillStyle
@dc.setFillStyle(fillStyle)
@dc.fillStyle = fillStyle
assert_equal(fillStyle, @dc.fillStyle)
assert_equal(fillStyle, @dc.getFillStyle())
end
def testFillRule
@dc.setFillRule(fillRule)
@dc.fillRule = fillRule
assert_equal(fillRule, @dc.fillRule)
assert_equal(fillRule, @dc.getFillRule())
end
def testFunction
@dc.setFunction(func)
@dc.function = func
assert_equal(func, @dc.function)
assert_equal(func, @dc.getFunction())
end
def testTile
image = nil
@dc.setTile(image)
@dc.setTile(image, dx)
@dc.setTile(image, dx, dy)
assert_same(image, @dc.tile)
assert_same(image, @dc.getTile())
end
def testStippleBitmap
bitmap = nil
@dc.setStipple(bitmap)
@dc.setStipple(bitmap, dx)
@dc.setStipple(bitmap, dx, dy)
assert_same(bitmap, @dc.stippleBitmap)
assert_same(bitmap, @dc.getStippleBitmap())
end
def testStipplePattern
for pat in patterns
@dc.setStipple(pat)
@dc.setStipple(pat, dx)
@dc.setStipple(pat, dx, dy)
assert_equal(pat, @dc.stipplePattern)
assert_equal(pat, @dc.getStipplePattern())
end
end
def testClipRegion
@dc.setClipRegion(region)
end
def testClipRectangle
clipX, clipY, clipWidth, clipHeight = 0, 0, 10, 20
clipRectangle = FXRectangle.new(clipX, clipY, clipWidth, clipHeight)
@dc.setClipRectangle(clipX, clipY, clipWidth, clipHeight)
assert_equal(clipX, @dc.clipX)
assert_equal(clipY, @dc.clipY)
assert_equal(clipWidth, @dc.clipWidth)
assert_equal(clipHeight, @dc.clipHeight)
assert_equal(clipRectangle, @dc.clipRectangle)
@dc.setClipRectangle(clipRectangle)
assert_equal(clipX, @dc.clipX)
assert_equal(clipY, @dc.clipY)
assert_equal(clipWidth, @dc.clipWidth)
assert_equal(clipHeight, @dc.clipHeight)
assert_equal(clipRectangle, @dc.clipRectangle)
@dc.clearClipRectangle
end
def testClipMask
@dc.setClipMask(bitmap)
@dc.setClipMask(bitmap, dx)
@dc.setClipMask(bitmap, dx, dy)
@dc.clearClipMask
end
def testTextFont
textFont = nil
@dc.setTextFont(textFont)
assert_same(textFont, @dc.textFont)
assert_same(textFont, @dc.getTextFont())
@dc.textFont = textFont
assert_same(textFont, @dc.textFont)
assert_same(textFont, @dc.getTextFont())
end
def testClipChildren
@dc.clipChildren(true)
@dc.clipChildren(false)
end
end
|