Sha256: 01d2f8506cf1b03f7a70816fba22602f78c426a07625b279308b1acb108735fb

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require_relative 'helper'
require_relative '../lib/xrandr'

module Xrandr
  class OutputTest < Minitest::Test
    def test_new_raises_if_no_name
      assert_raises ArgumentError do
        Output.new connected: false
      end
    end

    def test_new_raises_if_no_connection_info
      assert_raises ArgumentError do
        Output.new name: 'o'
      end
    end

    def test_status_returns_disconnected_when_output_is_not_connected
      o = Output.new name: 'out1', connected: false

      assert_equal 'disconnected', o.status
    end

    def test_status_returns_on_when_output_has_current_mode_set
      o = Output.new name: 'out1', connected: true, modes: [ Mode.new(current: true, rate: '60hz', preferred: true, resolution: '1920x1080') ]

      assert_equal 'on', o.status
    end

    def test_status_returns_off_when_output_has_no_current_mode_set
      o = Output.new name: 'out1', connected: true, modes: [ Mode.new(current: false, rate: '60hz', preferred: false, resolution: '1920x1080') ]

      assert_equal 'off', o.status
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xrandr-0.0.5 test/output_test.rb
xrandr-0.0.4 test/output_test.rb
xrandr-0.0.3 test/output_test.rb