Sha256: a67833d85894f6603506bde74a619a0f9b8c00f0377d8f591454da4e1f344fee

Contents?: true

Size: 1.93 KB

Versions: 12

Compression:

Stored size: 1.93 KB

Contents

#
# An FXRuby stress test developed by Gilles Filippini
#

require "fox16"

include Fox

# Test case tuning
NUMBER_OF_ITEMS = 1000
RESTART_FREQUENCY = 20

# =======================================================================
# Tree
# =======================================================================
class DirTree < FXTreeList
  def initialize(p)
    super(p, :opts => TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y)
  end

  def create
    super
    item = appendItem(nil, "root")
    @currentItem = item
    expand
  end

  def expand
    expandTree(@currentItem, true)
    listSubDir(@currentItem)
  end

  # Updating entries of dir
  def listSubDir(parentItem)
    entries = (1..NUMBER_OF_ITEMS).collect { |i| i.to_s }
    entries.each do |entry|
      item = appendItem(parentItem, entry)
      @currentItem = item if entry == "1"
    end
  end
end

# =======================================================================
# Application
# =======================================================================
class Application < FXApp
  include Responder

  ID_TIMER, ID_LAST = enum(FXApp::ID_LAST, 2)

  def initialize
    super("FXTreeList Bug (the come back)", "Pini")

    FXMAPFUNC(SEL_TIMEOUT, ID_TIMER, "onCount")

    self.threadsEnabled = false
    init(ARGV)

    @mainWindow = FXMainWindow.new(self, appName, nil, nil, DECOR_ALL, 0, 0, 400, 600)
    @dirTree = DirTree.new(@mainWindow) 

    @count = 0
  end 

  def create
    super
    @mainWindow.show(PLACEMENT_SCREEN)
    addTimeout(100, self, ID_TIMER)
  end

  def onCount(sender, sel, ptr)
    @count += 1
    puts "count = #{@count}"
    if @count % RESTART_FREQUENCY == 0
      @dirTree.clearItems
      @dirTree.create
    end
    @dirTree.expand
    addTimeout(100, self, ID_TIMER)
  end
end

if __FILE__ == $0
# Make application
  application = Application.new
  
  # Create app  
  application.create()
  
  # Run
  application.run()
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
fxruby-1.6.22.pre2-x86-mingw32 test/stress1.rb
fxruby-1.6.22.pre2 test/stress1.rb
fxrubi-1.6.22.pre1-x86-mingw32 test/stress1.rb
fxrubi-1.6.22.pre1 test/stress1.rb
fxruby-1.6.20-x86-mingw32 test/stress1.rb
fxruby-1.6.20-x86-linux test/stress1.rb
fxruby-1.6.20 test/stress1.rb
fxruby-1.6.20-universal-darwin-10 test/stress1.rb
fxruby-1.6.19-x86-mingw32 tests/stress1.rb
fxruby-1.6.19-universal-darwin-9 tests/stress1.rb
fxruby-1.6.19-x86-mswin32-60 tests/stress1.rb
fxruby-1.6.19 tests/stress1.rb