motion-gyro-image-controller 1.2 → 1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjQwOWZhNGY4NzExZDdmMDhkZTg0N2M3YmYzNjMxNzM1ZDAzM2M4Nw==
4
+ ZmQzMjUwNDdkZWU3NTM0NDYwMTEwYzVjOGU5NmUxMGM0OWQyNzZhOQ==
5
5
  data.tar.gz: !binary |-
6
- OGY2OTZiOTZiMmY2NTE1YTkxNmNjMmE0NGI2YjJhMzEyNDRhMTY0MA==
6
+ MGFiMDlkM2Y3MDBmMDU5N2VkZTUxMTA0YTJmMDQ0Zjk4NzhhMjM3MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTcyNDY3MGM5YTI3ZDM3NzZiOWZkYWIzYmZmOWQ1NzFjNWFjMGM4ZjQwODA3
10
- ODJiNzc4ZmQxY2VmZmZhZWMxNzljZWU0YjAxNTFiMDQ3ZjAxMmYxOGJkNjFk
11
- ZDJlZDRiNDZhMjczZWVmZGRlZTZmZTUzM2YzNzAzYmQ1ZmQ3YWQ=
9
+ NGE2YTgyMzVhMjdlZDlmNzIyMjZhNjI0NGJlZmI2MjMyNjQxZTkyMTJmNTc3
10
+ N2E5NDc0Mzk2YjVlMTg4YWYxOGQ0NDMyNGQ5YjZjNGU0OTU1ZDU2ZmZhOTU3
11
+ ZTAzNjA0OWYyZmQ2OTFiODJkMDQ1ZGMzZjkwMDYwYzdiN2UzYzQ=
12
12
  data.tar.gz: !binary |-
13
- N2Q4YzAxMmVjYzQzZTZiNmM2OWNkMWNhZDkxMDNlYTJiNGY3ODE4MzFkZDI4
14
- YTEzNDAyNWE2Y2RkODk4YmM5ZTliMDFhYmQ2YzgwNjNhNTE0ODg4YTYzODFi
15
- MmZmMzc4NGMxZjAxODAwZTdhYjJhOWZhMjFmNWQ0ZjdiM2RmN2I=
13
+ YmQzODQ3NGUzMzdiY2M4MGRhZDE5ZTVlMWNiZDQwY2EzMGE3MjI0Y2FkMzVm
14
+ NGI2MjIzZDI3ZGRmMjg2ZDk0OTFhYzAyZDU4ZDk0Nzc2ZWVlMmU1Mjc0YTU5
15
+ MzYzMDU3NjYxMzM5ZjMxMDY5YjgxMTZkZmYwMTQ3NTU5YzI5Nzk=
@@ -92,6 +92,6 @@ class GyroDrivenImageViewController < ScrollingImageViewController
92
92
 
93
93
  def fit_image_to_height
94
94
  super
95
- setup_gyro if gyro_available
95
+ set_up_gyro if gyro_available
96
96
  end
97
97
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "motion-gyro-image-controller"
7
- spec.version = "1.2"
7
+ spec.version = "1.3"
8
8
  spec.authors = ["Multunus"]
9
9
  spec.email = ["info@multunus.com"]
10
10
  spec.summary = %q{A controller that lets you control images using gyro}
@@ -0,0 +1,40 @@
1
+ describe GyroDrivenImageViewController do
2
+
3
+ before do
4
+ @gyro_image_controller = GyroDrivenImageViewController.new
5
+ @gyro_image_controller.set_up_view(0,0,640,568)
6
+ @gyro_image_controller.shake_threshold = 0.1
7
+ @gyro_image_controller.viewDidLoad
8
+ end
9
+
10
+ it "should initialize the motion manager" do
11
+ @gyro_image_controller.instance_variable_get(:@motion_manager).class.should == CMMotionManager
12
+ end
13
+
14
+ it "should set up the gyro on screen appear" do
15
+ @gyro_image_controller.should.receive(:set_up_gyro)
16
+ @gyro_image_controller.viewDidAppear nil
17
+ end
18
+
19
+ it "should tear down the gyro on screen disappear" do
20
+ @gyro_image_controller.should.receive(:tear_down_gyro)
21
+ @gyro_image_controller.viewWillDisappear nil
22
+ end
23
+
24
+ describe "new scroll offset on tilt" do
25
+ before do
26
+ @gyro_image_controller.set_up_view(0,0,320,568)
27
+ @gyro_image_controller.set_image UIImage.imageNamed("sample_640_spec_image.jpeg")
28
+ end
29
+
30
+ it "should return the scroll offset when shifting to the left" do
31
+ new_offset = @gyro_image_controller.get_scroll_offset_towards_left 0.5
32
+ new_offset.should == 80
33
+ end
34
+
35
+ it "should return the scroll offset when shifting to the right" do
36
+ new_offset = @gyro_image_controller.get_scroll_offset_towards_right -0.5
37
+ new_offset.round.should == 240
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-gyro-image-controller
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Multunus
@@ -61,7 +61,9 @@ files:
61
61
  - resources/.DS_Store
62
62
  - resources/Default-568h@2x.png
63
63
  - resources/placeholder.jpeg
64
+ - resources/sample_640_spec_image.jpeg
64
65
  - resources/sample_spec_image.jpeg
66
+ - spec/gyro_driven_image_controller_spec.rb
65
67
  - spec/main_spec.rb
66
68
  - spec/paged_image_controller_spec.rb
67
69
  - spec/scrolling_image_view_controller_spec.rb
@@ -90,6 +92,7 @@ signing_key:
90
92
  specification_version: 4
91
93
  summary: A controller that lets you control images using gyro
92
94
  test_files:
95
+ - spec/gyro_driven_image_controller_spec.rb
93
96
  - spec/main_spec.rb
94
97
  - spec/paged_image_controller_spec.rb
95
98
  - spec/scrolling_image_view_controller_spec.rb