mirror of
https://github.com/vidarh/ruby-x11
synced 2024-12-27 09:59:21 +01:00
a503b8391e
X11 Protocol expects clients to track unique identifiers in order to reduce network traffic. This reduces network traffic because when you create a new resource say a window the X11 server doesn't have to reply with the ID of the newly created resource. This makes the X11 protocol extremely fast since most requests the server doesn't need to reply to a message. In the first packet returned from X11 they give you a resource-id-mask and a resource-id-base. You can use these values to generate a unique id for X11.
15 lines
352 B
Ruby
15 lines
352 B
Ruby
require File.expand_path('../helper', __FILE__)
|
|
|
|
describe X11 do
|
|
describe X11::Display do
|
|
before(:each) do
|
|
@display = X11::Display.new
|
|
end
|
|
|
|
it "should generate a unique id" do
|
|
collection = 1000.times.collect { @display.new_id }
|
|
expected = collection.size
|
|
collection.uniq.size.must_equal expected
|
|
end
|
|
end
|
|
end
|