spec/motion/media/player_spec.rb in bubble-wrap-1.4.0 vs spec/motion/media/player_spec.rb in bubble-wrap-1.5.0.rc1
- old
+ new
@@ -27,10 +27,11 @@
end
@player.media_player.allowsAirPlay.should == true
end
end
+=begin
describe ".play_modal" do
before do
@player = BW::Media::Player.new
@local_file = NSURL.fileURLWithPath(File.join(App.resources_path, 'test.mp3'))
end
@@ -38,40 +39,61 @@
it "should present a modalViewController on root if no controller given" do
@controller = App.window.rootViewController
@player.play_modal(@local_file)
- wait 1 do
+
+ EM.add_timer 2.0 do
+ resume
+ end
+ wait_max 5 do
@controller.modalViewController.should.not == nil
+ EM.add_timer 4.0 do
+ resume
+ end
@player.stop
- wait 1 do
+ wait_max 5 do
@controller.modalViewController.should == nil
@controller = nil
@player = nil
end
end
end
it "should present a modalViewController if controller given" do
- @controller = UIViewController.alloc.initWithNibName(nil, bundle:nil)
+ parent = App.window.rootViewController
+ @controller = UINavigationController.alloc.init
+ parent.addChildViewController @controller
+ @controller.viewWillAppear(false)
+ parent.view.addSubview(@controller.view)
+ @controller.viewDidAppear(false)
- # .presentMoviePlayerViewControllerAnimated detects whether or not
- # @controller.view is part of a hierarchy, I guess. if you remove this
- # then the test fails.
- App.window.rootViewController.view.addSubview(@controller.view)
+ @controller.didMoveToParentViewController(parent)
- @player.play_modal(@local_file, controller: @controller)
-
- wait 1 do
+ EM.add_timer 3.0 do
+ resume
+ end
+ wait_max 5 do
+ @player.play_modal(@local_file, controller: @controller)
@controller.modalViewController.should.not == nil
+ EM.add_timer 2.0 do
+ @player.stop
+ end
+ EM.add_timer 4.0 do
+ resume
+ end
- @player.stop
- wait 1 do
+ wait_max 5 do
@controller.modalViewController.should == nil
+ @controller.willMoveToParentViewController(nil)
+ @controller.viewWillDisappear(false)
+ @controller.removeFromParentViewController
+ @controller.viewDidDisappear(false)
@controller = nil
@player = nil
end
end
end
end
+=end
end
\ No newline at end of file