Sha256: d24a60a9f46fb85624e11801879c278df4fc4e067b605fa9240445b709a15828

Contents?: true

Size: 1.92 KB

Versions: 100

Compression:

Stored size: 1.92 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

100 entries across 100 versions & 1 rubygems

Version Path
fxruby-1.6.48 test/stress1.rb
fxruby-1.6.48-x64-mingw32 test/stress1.rb
fxruby-1.6.48-x64-mingw-ucrt test/stress1.rb
fxruby-1.6.48-x86-mingw32 test/stress1.rb
fxruby-1.6.47 test/stress1.rb
fxruby-1.6.47-x64-mingw-ucrt test/stress1.rb
fxruby-1.6.47-x64-mingw32 test/stress1.rb
fxruby-1.6.47-x86-mingw32 test/stress1.rb
fxruby-1.6.46 test/stress1.rb
fxruby-1.6.46-x64-mingw32 test/stress1.rb
fxruby-1.6.46-x64-mingw-ucrt test/stress1.rb
fxruby-1.6.46-x86-mingw32 test/stress1.rb
fxruby-1.6.45 test/stress1.rb
fxruby-1.6.45-x64-mingw32 test/stress1.rb
fxruby-1.6.45-x64-mingw-ucrt test/stress1.rb
fxruby-1.6.45-x86-mingw32 test/stress1.rb
fxruby-1.6.44 test/stress1.rb
fxruby-1.6.44-x64-mingw32 test/stress1.rb
fxruby-1.6.44-x86-mingw32 test/stress1.rb
fxruby-1.6.43 test/stress1.rb