Sha256: 82d72b6772b99d84ba30e6660c9ffa9d2fa512946a38decf81b85af97ab551b9

Contents?: true

Size: 1.97 KB

Versions: 60

Compression:

Stored size: 1.97 KB

Contents

require 'rho/mapview'

describe "MapView" do

  it "should create" do
    state = MapView.state
    state.should be_nil

    MapView.create :settings => {:map_type => 'roadmap', :region => [37, -122, 10, 10]}
    w = 5
    #w = 5 if System::get_property('platform') == 'ANDROID'
    sleep 60

    state = MapView.state
    state.should_not be_nil
    state.is_a?(Hash).should == true 
    delta = 0.001
    (state[:center][:latitude] - 37.0).abs.should  < delta
    (state[:center][:longitude] - (-122.0)).abs.should  < delta

    MapView.close
    sleep 20

    state = MapView.state
    state.should be_nil
  end


  it "should create 250 annotations" do
    state = MapView.state
    state.should be_nil

     myannotations = []
     250.times do |j|
          annotation = {:latitude => '37.349691', :longitude => '-121.983261', :title => "Test Location", :subtitle => "test", :url => "/app/GeoLocation/show?city=Current Location"}	
          myannotations << annotation
     end

     myannotations <<   {:street_address => "Cupertino, CA 95014", :title => "Cupertino", :subtitle => "zip: 95014", :url => "/app/GeoLocation/show?city=Cupertino"}
     myannotations << {:street_address => "Santa Clara, CA 95051", :title => "Santa Clara", :subtitle => "zip: 95051", :url => "/app/GeoLocation/show?city=Santa%20Clara"}

     map_params = {
          :settings => {:map_type => "roadmap", :region => [37, -122, 10, 10],
                        :zoom_enabled => true, :scroll_enabled => true, :shows_user_location => true },
          :annotations => myannotations
     }

    MapView.create map_params

    w = 5
    #w = 5 if System::get_property('platform') == 'ANDROID'
    sleep 60

    state = MapView.state
    state.should_not be_nil
    state.is_a?(Hash).should == true 
    delta = 0.001
    (state[:center][:latitude] - 37.0).abs.should  < delta
    (state[:center][:longitude] - (-122.0)).abs.should  < delta

    MapView.close
    sleep 20

    state = MapView.state
    state.should be_nil
  end




end

Version data entries

60 entries across 60 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-7.5.1 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-7.4.1 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-7.1.17 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-6.2.0 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-6.0.11 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-5.5.18 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-5.5.17 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-5.5.15 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-5.5.0.22 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-5.5.2 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-5.5.0.7 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-5.5.0.3 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-5.5.0 spec/phone_spec/app/spec/mapview_spec.rb
tauplatform-1.0.3 spec/phone_spec/app/spec/mapview_spec.rb
tauplatform-1.0.2 spec/phone_spec/app/spec/mapview_spec.rb
tauplatform-1.0.1 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-3.5.1.12 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-3.3.5 spec/phone_spec/app/spec/mapview_spec.rb
rhodes-3.4.2 spec/phone_spec/app/spec/mapview_spec.rb