Tree @12e77b9e-e141-461f-8c41-54c8e546ab7b/upstream (Download .tar.gz)
- ..
- blankpage.ps
- dummy.xorg.conf
- howdypage.ps
- README
- stress1.rb
- stress2.rb
- stress3.rb
- TC_downcast.rb
- TC_FXAccelTable.rb
- TC_FXApp.rb
- TC_FXArc.rb
- TC_FXBMPIcon.rb
- TC_FXBMPImage.rb
- TC_FXButton.rb
- TC_FXCheckButton.rb
- TC_FXComboBox.rb
- TC_FXDataTarget.rb
- TC_FXDC.rb
- TC_FXDCPrint.rb
- TC_FXDCWindow.rb
- TC_FXDialogBox.rb
- TC_FXDirList.rb
- TC_FXExtentd.rb
- TC_FXExtentf.rb
- TC_FXFileAssoc.rb
- TC_FXFileStream.rb
- TC_FXFoldingList.rb
- TC_FXFont.rb
- TC_FXFontDesc.rb
- TC_FXGLGroup.rb
- TC_FXGLShape.rb
- TC_FXGLViewer.rb
- TC_FXGradientBar.rb
- TC_FXHeader.rb
- TC_FXHiliteStyle.rb
- TC_FXIconDict.rb
- TC_FXIconList.rb
- TC_FXId.rb
- TC_FXImage.rb
- TC_FXJPGImage.rb
- TC_FXLight.rb
- TC_FXList.rb
- TC_FXListBox.rb
- TC_FXMainWindow.rb
- TC_FXMat4f.rb
- TC_FXMaterial.rb
- TC_FXMemoryStream.rb
- TC_FXMenuCheck.rb
- TC_FXMenuCommand.rb
- TC_FXMenuRadio.rb
- TC_FXMessageBox.rb
- TC_FXPoint.rb
- TC_FXQuatf.rb
- TC_FXRadioButton.rb
- TC_FXRanged.rb
- TC_FXRangef.rb
- TC_FXRectangle.rb
- TC_FXRegion.rb
- TC_FXRegistry.rb
- TC_FXScrollArea.rb
- TC_FXScrollWindow.rb
- TC_FXSegment.rb
- TC_FXSettings.rb
- TC_FXShell.rb
- TC_FXSize.rb
- TC_FXStream.rb
- TC_FXTable.rb
- TC_FXTableItem.rb
- TC_FXText.rb
- TC_FXTopWindow.rb
- TC_FXTreeList.rb
- TC_FXTreeListBox.rb
- TC_FXUndoList.rb
- TC_FXVec2d.rb
- TC_FXVec2f.rb
- TC_FXVec3d.rb
- TC_FXVec3f.rb
- TC_FXVec4f.rb
- TC_FXViewport.rb
- TC_FXWindow.rb
- TC_FXXBMIcon.rb
- TC_FXXBMImage.rb
- TC_FXXPMIcon.rb
- TC_FXXPMImage.rb
- TC_Misc.rb
- testcase.rb
- TS_All.rb
TC_FXApp.rb @12e77b9e-e141-461f-8c41-54c8e546ab7b/upstream — raw · history · blame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | require 'test/unit'
require 'fox16'
require 'testcase'
require 'socket'
class TC_FXApp < Test::Unit::TestCase
include Fox
def test_exception_for_second_app
assert_raise RuntimeError do
FXApp.new
end
end
end
class TC_FXApp2 < Fox::TestCase
include Fox
def setup
super(self.class.name)
end
def test_nil_window_raises_argument_error
assert_raise(ArgumentError){ app.runPopup(nil) }
end
def check_events(pipe_rd, pipe_wr)
app.addInput(pipe_wr, INPUT_WRITE, app, FXApp::ID_QUIT)
app.run
app.removeInput(pipe_wr, INPUT_WRITE)
app.addInput(pipe_rd, INPUT_READ, app, FXApp::ID_QUIT)
2.times do
data_sent = false
app.addTimeout(1) do
data_sent = true
pipe_wr.write " "
end
app.run
assert data_sent, "the read input event shouldn't fire before some data is available"
assert " ", pipe_rd.read(1)
end
app.removeInput(pipe_rd, INPUT_READ)
pipe_wr.close
pipe_rd.close unless pipe_rd.closed?
end
def test_addInput_on_pipe
pend "addInput on IO.pipe object isn't supported on Windows" if RUBY_PLATFORM=~/mingw|mswin/i
check_events(*IO.pipe)
end
def test_addInput_on_socket_accept
s = TCPServer.open 'localhost', 0
app.addInput(s, INPUT_READ, app, FXApp::ID_QUIT)
2.times do
pipe_wr = nil
app.addTimeout(1) do
pipe_wr = TCPSocket.open 'localhost', s.addr[1]
end
app.run
assert pipe_wr, "the read input event shouldn't fire before client connection happens"
s.accept.close
end
app.removeInput(s, INPUT_READ)
s.close
end
def test_addInput_on_socket
s = TCPServer.open 'localhost', 0
pipe_wr = TCPSocket.open 'localhost', s.addr[1]
pipe_rd = s.accept
s.close
check_events pipe_rd, pipe_wr
end
def test_addInput_on_popen
pend "addInput on IO.popen object isn't supported on Windows" if RUBY_PLATFORM=~/mingw|mswin/i
pipe_rdwr = IO.popen("cat", "r+")
check_events pipe_rdwr, pipe_rdwr
end
def test_runOnUiThread
count = 0
thread = nil
Thread.new do
10.times do |idx|
app.runOnUiThread do
count += 1
thread = Thread.current
app.stop if idx == 9
end
sleep 0.001
end
end
app.run
assert_equal Thread.current, thread
assert_equal 10, count
end
def test_runOnUiThread_same_thread
count = 0
app.addTimeout(1) do
10.times do |idx|
app.runOnUiThread do
count += 1
app.stop if idx == 9
end
sleep 0.001
end
end
app.run
assert_equal 10, count
end
end
|