Sha256: f01bf226df1d8891dcfdeecce02e85985f50e51915d1853808a30c564afd10b5

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
require 'volay/widget/volume_control'

describe 'Volay::Widget::VolumeControl' do
  let(:app) do
    app = double
    allow(app).to receive(:mixer).and_return(double)
    allow(app).to receive(:signals_list).and_return({})
    app
  end

  let(:vc) do
    allow(Thread).to receive(:new).and_yield
    Volay::Widget::VolumeControl.new(app)
  end

  it 'on volume scale' do
    utils = double
    volume = double

    allow(volume).to receive(:value).once.and_return(20)
    allow(utils).to receive(:update_status_icon).once.and_return(true)

    allow(app).to receive(:utils).once.and_return(utils)
    allow(app.mixer).to receive(:value=).with(20).once

    vc.on_volume_adjustement_value_changed(volume)
  end

  it 'no volume mute' do
    utils = double
    volume = double

    allow(volume).to receive(:active?).once.and_return(true)
    allow(utils).to receive(:update_status_icon).once.and_return(true)

    allow(app).to receive(:utils).once.and_return(utils)
    allow(app.mixer).to receive(:muted?).once.and_return(true)
    allow(app.mixer).to receive(:toggle).once

    vc.on_toggle_mute_toggled(volume)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
volay-2.2.0 spec/volay/widget/volume_control_spec.rb
volay-2.1.0 spec/volay/widget/volume_control_spec.rb