xrandr 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xrandr.rb +3 -2
  3. data/test/parser_test.rb +21 -0
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54a9da38bc2aeddeff800687a14c968a80d352ca
4
- data.tar.gz: b45125b3deab9e42e88673e5dc46502bff82a331
3
+ metadata.gz: e7bb660cead9fafcbb58f35a0eb7c3981f9c4f20
4
+ data.tar.gz: cd6d57377f91e780b8a5a74e91887f1abb9f58b0
5
5
  SHA512:
6
- metadata.gz: 7643280ba115869f60b870b7afe54e0d685a1a5cc7fc62d0b71260dc774479381b99479b0017c6cc0b86a39f272d76e7f0ca889499934567f887c613edcd0c88
7
- data.tar.gz: ab54aa857ba5c623ac8b06c34dddd51123a4b5bb95075a8707d5c862c928fcc0aef16626be5ad95f9c818a3a0bdba816f79716e614d7b39107bd50a806a6f8a6
6
+ metadata.gz: 968287ec8fd4c1159c40b7087a1047a06a9f79f176617ed72c1241130b7ef3891aaa77e0991fdccfe09623536ba943dbc8e7fa78686eb2468957eaf73dd7f7e9
7
+ data.tar.gz: 4eb35f1d52c17e46442d637c4a29ddaabf6873920fab6a45adf6695e5446edf2a3ff2306f9d19cd0250f87fb9f2938b520a7c2e8137da28ca8407539de9cd6d5
data/lib/xrandr.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Xrandr
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
 
4
4
  class Control
5
5
  attr_reader :screens, :outputs, :command
@@ -83,7 +83,8 @@ module Xrandr
83
83
  args[:primary] = args[:primary] == 'primary'
84
84
 
85
85
  # Parse modes
86
- args[:modes] = parse_modes(modes)
86
+
87
+ args[:modes] = args[:connected] ? parse_modes(modes) : []
87
88
 
88
89
  Output.new args
89
90
  end
data/test/parser_test.rb CHANGED
@@ -75,6 +75,27 @@ module Xrandr
75
75
  assert_empty output.modes
76
76
  refute output.primary
77
77
  end
78
+
79
+ def test_parse_output_recognizes_virtual_output_format
80
+ # when disconnecting a display that is actually being used, xrandr leaves a Virtual display with this kind of output
81
+ output = [
82
+ 'VIRTUAL1 disconnected (normal left inverted right x axis y axis)',
83
+ ' 1920x1080 (0x4b) 148.500MHz',
84
+ ' h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 67.50KHz',
85
+ ' v: height 1080 start 1084 end 1089 total 1125 clock 60.00Hz'
86
+ ]
87
+
88
+ output = Parser.new.parse_output output
89
+
90
+ assert_equal 'VIRTUAL1', output.name
91
+ refute output.connected
92
+ assert_equal '(normal left inverted right x axis y axis)', output.info
93
+ assert_nil output.dimensions
94
+ assert_nil output.resolution
95
+ assert_nil output.position
96
+ assert_empty output.modes
97
+ end
98
+
78
99
  end
79
100
 
80
101
  class Parser::ParseModeTest < Minitest::Test
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrandr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Martínez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.4.5
80
+ rubygems_version: 2.4.5.1
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: A ruby wrapper for Xrandr