Sha256: 57cfbd1bd580742306ec1f91d59c4cbd011bd8d90a4ab21ea0a3ecc8cf6427a3

Contents?: true

Size: 1.84 KB

Versions: 17

Compression:

Stored size: 1.84 KB

Contents

require 'test_helper'

module Extface
  class Driver::Posiflex::Aura80Test < ActiveSupport::TestCase
    setup do
      @driver = extface_drivers(:posiflex_aura80)
      @driver.flush # clear receive buffer
    end
    
    test "handle" do
      assert_equal 1, @driver.handle("\x0C")
    end
    
    test "status" do
      job = extface_jobs(:one)
      job_thread = Thread.new do
        @driver.set_job(job)
      end
      data = simulate_device_pull(job)
      assert_equal data.b, @driver.class::Info::GET_PAPER_STATUS
      @driver.handle("\x00")
      job_thread.join
      assert @driver.errors.empty?, @driver.errors.full_messages
    end
    
    test "paper out" do
      job = extface_jobs(:one)
      job_thread = Thread.new do
        @driver.set_job(job)
      end
      data = simulate_device_pull(job)
      assert_equal data.b, @driver.class::Info::GET_PAPER_STATUS
      @driver.handle("\x0C")
      job_thread.join
      assert_equal @driver.errors.messages[:base], ["Paper out"]
    end
    
    test "autocut" do
      job = extface_jobs(:one)
      job_thread = Thread.new do
        @driver.set_job(job)
        @driver.autocut
      end
      simulate_device_pull(job) #status command
      @driver.handle("\x00")
      data = simulate_device_pull(job)
      assert_equal data.b, @driver.class::Printer::PAPER_CUT
      job_thread.join
    end
  end
end

# https://sourceforge.net/p/chromispos/discussion/help/thread/c004783b/2fc4/attachment/Aura%20Printer%20Command%20Manual.pdf
# Paper sensor status [n =1, 49]
# Bit Off/On Hex Decimal Status for ASB
# 0, Off 00 0 Paper roll near-end sensor: paper adequate.
# 1 On 03 3 Paper roll near-end sensor: paper near end.
# 2, Off 00 0 Paper out sensor: paper adequate.
# 3 On 0C 12 Paper out sensor: paper out.
# 4 Off 00 0 Not used Fixed to Off.
# 5,
# 6
# - - - Undefined.
# 7 Off 00 0 Not used Fixed to Off. 

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
extface-0.7.3 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.7.2 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.7.1 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.7.0 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.9 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.8 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.7 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.6 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.5 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.4 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.3 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.2 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.1 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.6.0 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.5.9 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.5.8 test/models/extface/driver/posiflex/aura80_test.rb
extface-0.5.7 test/models/extface/driver/posiflex/aura80_test.rb