win32screenshot 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +6 -0
- data/History.rdoc +23 -0
- data/LICENSE +20 -0
- data/README.rdoc +51 -0
- data/Rakefile +48 -46
- data/VERSION +1 -0
- data/lib/win32/screenshot.rb +36 -0
- data/lib/win32/screenshot/bitmap_maker.rb +168 -0
- data/lib/win32screenshot.rb +3 -130
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +68 -0
- data/spec/win32_screenshot_spec.rb +91 -0
- metadata +105 -50
- data/History.txt +0 -7
- data/Manifest.txt +0 -9
- data/README.txt +0 -3
- data/lib/win32screenshot/version.rb +0 -9
- data/setup.rb +0 -1585
- data/test/test_helper.rb +0 -2
- data/test/win32screenshot_test.rb +0 -43
data/test/test_helper.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
-
require 'rubygems'
|
3
|
-
require 'RMagick'
|
4
|
-
|
5
|
-
# Prereqs for this test:
|
6
|
-
# * Must be run from a command window with dimensions 1600x1200 pixels (160x60 characters, default font)
|
7
|
-
# * Screen res must be 1600x1200
|
8
|
-
# * Must have a maximised Firefox open
|
9
|
-
#
|
10
|
-
class Win32screenshotTest < Test::Unit::TestCase
|
11
|
-
|
12
|
-
def test_should_capture_foreground
|
13
|
-
width, height, bmp = Win32::Screenshot.foreground
|
14
|
-
assert_equal 1280, width
|
15
|
-
assert_equal 720, height
|
16
|
-
assert_image(bmp)
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_should_capture_desktop
|
20
|
-
width, height, bmp = Win32::Screenshot.desktop
|
21
|
-
assert_equal 1600, width
|
22
|
-
assert_equal 1200, height
|
23
|
-
assert_image(bmp)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_should_capture_window_by_title
|
27
|
-
width, height, bmp = Win32::Screenshot.window(/Firefox/)
|
28
|
-
assert_equal 1600, width
|
29
|
-
assert_equal 1147, height
|
30
|
-
assert_image(bmp, "ff.png")
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
def assert_image(bmp, file=nil)
|
35
|
-
assert_equal 'BM', bmp[0..1]
|
36
|
-
img = Magick::Image.from_blob(bmp)
|
37
|
-
png = img[0].to_blob do
|
38
|
-
self.format = 'PNG'
|
39
|
-
end
|
40
|
-
assert_equal "\211PNG", png[0..3]
|
41
|
-
File.open(file, "wb") {|io| io.write(png)} unless file.nil?
|
42
|
-
end
|
43
|
-
end
|