bubble-wrap 1.2.0 → 1.3.0.osx
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 +8 -8
- data/CHANGELOG.md +4 -2
- data/Gemfile.lock +1 -1
- data/README.md +217 -7
- data/Rakefile +23 -2
- data/lib/bubble-wrap/camera.rb +10 -6
- data/lib/bubble-wrap/core.rb +14 -1
- data/lib/bubble-wrap/ext/motion_project_app.rb +8 -0
- data/lib/bubble-wrap/font.rb +3 -1
- data/lib/bubble-wrap/http.rb +2 -0
- data/lib/bubble-wrap/loader.rb +17 -2
- data/lib/bubble-wrap/location.rb +9 -6
- data/lib/bubble-wrap/media.rb +10 -6
- data/lib/bubble-wrap/test.rb +6 -1
- data/lib/bubble-wrap/ui.rb +5 -2
- data/lib/bubble-wrap/version.rb +2 -7
- data/motion/core.rb +6 -1
- data/motion/core/app.rb +3 -64
- data/motion/core/device.rb +0 -55
- data/motion/core/device/{camera.rb → ios/camera.rb} +0 -0
- data/motion/core/device/{camera_wrapper.rb → ios/camera_wrapper.rb} +0 -0
- data/motion/core/device/ios/screen.rb +75 -0
- data/motion/core/device/osx/screen.rb +18 -0
- data/motion/core/device/screen.rb +1 -69
- data/motion/core/ios/app.rb +71 -0
- data/motion/core/ios/device.rb +59 -0
- data/motion/core/osx/app.rb +15 -0
- data/motion/core/osx/device.rb +6 -0
- data/motion/core/string.rb +3 -2
- data/motion/http.rb +0 -364
- data/motion/http/query.rb +367 -0
- data/motion/http/response.rb +32 -0
- data/motion/test_suite_delegate.rb +58 -0
- data/motion/ui/ui_alert_view.rb +169 -0
- data/motion/ui/ui_bar_button_item.rb +55 -53
- data/motion/util/constants.rb +34 -32
- data/samples/alert/.gitignore +16 -0
- data/samples/alert/Gemfile +3 -0
- data/samples/alert/Rakefile +10 -0
- data/samples/alert/app/app_delegate.rb +8 -0
- data/samples/alert/app/controllers/alert_view_controller.rb +74 -0
- data/samples/alert/resources/Default-568h@2x.png +0 -0
- data/samples/alert/spec/main_spec.rb +9 -0
- data/samples/media/.gitignore +16 -0
- data/samples/media/Rakefile +11 -0
- data/samples/media/app/app_delegate.rb +8 -0
- data/samples/media/app/controllers/play_controller.rb +46 -0
- data/samples/media/resources/Default-568h@2x.png +0 -0
- data/samples/media/resources/test.mp3 +0 -0
- data/samples/media/spec/main_spec.rb +9 -0
- data/samples/osx/Gemfile +3 -0
- data/samples/osx/Gemfile.lock +10 -0
- data/samples/osx/Rakefile +11 -0
- data/samples/osx/app/app_delegate.rb +69 -0
- data/samples/osx/app/menu.rb +108 -0
- data/samples/osx/resources/Credits.rtf +29 -0
- data/samples/osx/spec/main_spec.rb +9 -0
- data/spec/motion/core/app_spec.rb +5 -164
- data/spec/motion/core/device/{camera_spec.rb → ios/camera_spec.rb} +0 -0
- data/spec/motion/core/device/{camera_wrapper_spec.rb → ios/camera_wrapper_spec.rb} +0 -0
- data/spec/motion/core/device/ios/device_spec.rb +74 -0
- data/spec/motion/core/device/{screen_spec.rb → ios/screen_spec.rb} +2 -1
- data/spec/motion/core/device/osx/screen_spec.rb +26 -0
- data/spec/motion/core/device_spec.rb +0 -71
- data/spec/motion/core/ios/app_spec.rb +180 -0
- data/spec/motion/core/kvo_spec.rb +23 -7
- data/spec/motion/core/ns_index_path_spec.rb +10 -2
- data/spec/motion/core/osx/app_spec.rb +15 -0
- data/spec/motion/core/string_spec.rb +11 -5
- data/spec/motion/core_spec.rb +13 -2
- data/spec/motion/http/query_spec.rb +731 -0
- data/spec/motion/http/response_spec.rb +44 -0
- data/spec/motion/http_spec.rb +0 -722
- data/spec/motion/{core → ui}/gestures_spec.rb +0 -0
- data/spec/motion/ui/ui_alert_view_spec.rb +1188 -0
- data/spec/motion/{core → ui}/ui_bar_button_item_spec.rb +80 -24
- data/spec/motion/{core → ui}/ui_control_spec.rb +0 -0
- data/spec/motion/util/constants_spec.rb +4 -4
- metadata +86 -26
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
$:.unshift("/Library/RubyMotion/lib")
|
3
|
+
require 'motion/project'
|
4
|
+
|
5
|
+
$:.unshift("../../lib")
|
6
|
+
require 'bubble-wrap/media'
|
7
|
+
|
8
|
+
Motion::Project::App.setup do |app|
|
9
|
+
# Use `rake config' to see complete project settings.
|
10
|
+
app.name = 'media'
|
11
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AppDelegate
|
2
|
+
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
3
|
+
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
4
|
+
camera_controller = PlayController.alloc.init
|
5
|
+
@window.rootViewController = camera_controller
|
6
|
+
@window.makeKeyAndVisible
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class PlayController < UIViewController
|
2
|
+
attr_accessor :buttons
|
3
|
+
|
4
|
+
def init
|
5
|
+
super.tap do
|
6
|
+
@buttons = []
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def viewDidLoad
|
11
|
+
super
|
12
|
+
|
13
|
+
self.view.addSubview(build_button("Modal", "tapped_modal"))
|
14
|
+
self.view.addSubview(build_button("Frame", "tapped_frame"))
|
15
|
+
self.view.backgroundColor = UIColor.whiteColor
|
16
|
+
end
|
17
|
+
|
18
|
+
def build_button(title, callback)
|
19
|
+
button = UIButton.buttonWithType(UIButtonTypeRoundedRect)
|
20
|
+
button.setTitle(title, forState:UIControlStateNormal)
|
21
|
+
button.sizeToFit
|
22
|
+
|
23
|
+
rect = self.buttons.empty? ? CGRectMake(0, 0, 0, 0) : self.buttons.last.frame
|
24
|
+
|
25
|
+
button.frame = [[rect.origin.x, rect.origin.y + rect.size.height + 10], button.frame.size]
|
26
|
+
button.addTarget(self, action: callback, forControlEvents:UIControlEventTouchUpInside)
|
27
|
+
|
28
|
+
self.buttons << button
|
29
|
+
button
|
30
|
+
end
|
31
|
+
|
32
|
+
def local_file
|
33
|
+
NSURL.fileURLWithPath(File.join(NSBundle.mainBundle.resourcePath, 'test.mp3'))
|
34
|
+
end
|
35
|
+
|
36
|
+
def tapped_modal
|
37
|
+
BW::Media.play_modal(local_file)
|
38
|
+
end
|
39
|
+
|
40
|
+
def tapped_frame
|
41
|
+
BW::Media.play(local_file) do |media_player|
|
42
|
+
media_player.view.frame = [[10, 140], [self.view.frame.size.width - 20, 100]]
|
43
|
+
self.view.addSubview media_player.view
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
Binary file
|
Binary file
|
data/samples/osx/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
$:.unshift("/Library/RubyMotion/lib")
|
3
|
+
require 'motion/project/template/osx'
|
4
|
+
|
5
|
+
require 'bundler'
|
6
|
+
Bundler.require :default
|
7
|
+
|
8
|
+
Motion::Project::App.setup do |app|
|
9
|
+
# Use `rake config' to see complete project settings.
|
10
|
+
app.name = 'osx'
|
11
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
class AppDelegate
|
2
|
+
def applicationDidFinishLaunching(notification)
|
3
|
+
buildMenu
|
4
|
+
buildWindow
|
5
|
+
end
|
6
|
+
|
7
|
+
def buildWindow
|
8
|
+
@mainWindow = NSWindow.alloc.initWithContentRect([[240, 180], [480, 360]],
|
9
|
+
styleMask: NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
|
10
|
+
backing: NSBackingStoreBuffered,
|
11
|
+
defer: false)
|
12
|
+
@mainWindow.title = "What Is My IP?"
|
13
|
+
@mainWindow.orderFrontRegardless
|
14
|
+
|
15
|
+
@button = make_button("Find IP")
|
16
|
+
@button.target = self
|
17
|
+
@button.action = "fetch_ip"
|
18
|
+
|
19
|
+
@label = make_label("_._._._")
|
20
|
+
|
21
|
+
view = @mainWindow.contentView
|
22
|
+
view.addSubview(@button)
|
23
|
+
view.addSubview(@label)
|
24
|
+
|
25
|
+
views_hash = {"button" => @button, "label" => @label}
|
26
|
+
|
27
|
+
add_constraint "|-[button(<=200)]-|", to: view, views: views_hash
|
28
|
+
|
29
|
+
add_constraint "|-[label]-|", to: view, views: views_hash
|
30
|
+
|
31
|
+
add_constraint "V:|-[button]-10-[label]-(>=20,<=60)-|", to: view, views: views_hash
|
32
|
+
end
|
33
|
+
|
34
|
+
def fetch_ip
|
35
|
+
@button.title = "Loading"
|
36
|
+
BW::HTTP.get("http://jsonip.com") do |response|
|
37
|
+
ip = BW::JSON.parse(response.body.to_str)["ip"]
|
38
|
+
@label.stringValue = ip
|
39
|
+
@button.title = "Find IP"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def make_button(title)
|
44
|
+
button = NSButton.alloc.initWithFrame(CGRectZero)
|
45
|
+
button.title = title
|
46
|
+
button.buttonType = NSMomentaryLightButton
|
47
|
+
button.bezelStyle = NSRoundedBezelStyle
|
48
|
+
button.setTranslatesAutoresizingMaskIntoConstraints(false)
|
49
|
+
button
|
50
|
+
end
|
51
|
+
|
52
|
+
def make_label(text)
|
53
|
+
textField = NSTextField.alloc.initWithFrame(CGRectZero)
|
54
|
+
textField.stringValue = text
|
55
|
+
textField.alignment = NSCenterTextAlignment
|
56
|
+
textField.bezeled = false
|
57
|
+
textField.drawsBackground = false
|
58
|
+
textField.editable = false
|
59
|
+
textField.selectable = false
|
60
|
+
textField.setTranslatesAutoresizingMaskIntoConstraints(false)
|
61
|
+
textField
|
62
|
+
end
|
63
|
+
|
64
|
+
def add_constraint(ascii, params = {})
|
65
|
+
view = params[:to]
|
66
|
+
views_hash = params[:views]
|
67
|
+
view.addConstraints(NSLayoutConstraint.constraintsWithVisualFormat(ascii, options: 0, metrics: nil, views: views_hash))
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
class AppDelegate
|
2
|
+
def buildMenu
|
3
|
+
@mainMenu = NSMenu.new
|
4
|
+
|
5
|
+
appName = NSBundle.mainBundle.infoDictionary['CFBundleName']
|
6
|
+
addMenu(appName) do
|
7
|
+
addItemWithTitle("About #{appName}", action: 'orderFrontStandardAboutPanel:', keyEquivalent: '')
|
8
|
+
addItem(NSMenuItem.separatorItem)
|
9
|
+
addItemWithTitle('Preferences', action: 'openPreferences:', keyEquivalent: ',')
|
10
|
+
addItem(NSMenuItem.separatorItem)
|
11
|
+
servicesItem = addItemWithTitle('Services', action: nil, keyEquivalent: '')
|
12
|
+
NSApp.servicesMenu = servicesItem.submenu = NSMenu.new
|
13
|
+
addItem(NSMenuItem.separatorItem)
|
14
|
+
addItemWithTitle("Hide #{appName}", action: 'hide:', keyEquivalent: 'h')
|
15
|
+
item = addItemWithTitle('Hide Others', action: 'hideOtherApplications:', keyEquivalent: 'H')
|
16
|
+
item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
|
17
|
+
addItemWithTitle('Show All', action: 'unhideAllApplications:', keyEquivalent: '')
|
18
|
+
addItem(NSMenuItem.separatorItem)
|
19
|
+
addItemWithTitle("Quit #{appName}", action: 'terminate:', keyEquivalent: 'q')
|
20
|
+
end
|
21
|
+
|
22
|
+
addMenu('File') do
|
23
|
+
addItemWithTitle('New', action: 'newDocument:', keyEquivalent: 'n')
|
24
|
+
addItemWithTitle('Open…', action: 'openDocument:', keyEquivalent: 'o')
|
25
|
+
addItem(NSMenuItem.separatorItem)
|
26
|
+
addItemWithTitle('Close', action: 'performClose:', keyEquivalent: 'w')
|
27
|
+
addItemWithTitle('Save…', action: 'saveDocument:', keyEquivalent: 's')
|
28
|
+
addItemWithTitle('Revert to Saved', action: 'revertDocumentToSaved:', keyEquivalent: '')
|
29
|
+
addItem(NSMenuItem.separatorItem)
|
30
|
+
addItemWithTitle('Page Setup…', action: 'runPageLayout:', keyEquivalent: 'P')
|
31
|
+
addItemWithTitle('Print…', action: 'printDocument:', keyEquivalent: 'p')
|
32
|
+
end
|
33
|
+
|
34
|
+
addMenu('Edit') do
|
35
|
+
addItemWithTitle('Undo', action: 'undo:', keyEquivalent: 'z')
|
36
|
+
addItemWithTitle('Redo', action: 'redo:', keyEquivalent: 'Z')
|
37
|
+
addItem(NSMenuItem.separatorItem)
|
38
|
+
addItemWithTitle('Cut', action: 'cut:', keyEquivalent: 'x')
|
39
|
+
addItemWithTitle('Copy', action: 'copy:', keyEquivalent: 'c')
|
40
|
+
addItemWithTitle('Paste', action: 'paste:', keyEquivalent: 'v')
|
41
|
+
item = addItemWithTitle('Paste and Match Style', action: 'pasteAsPlainText:', keyEquivalent: 'V')
|
42
|
+
item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
|
43
|
+
addItemWithTitle('Delete', action: 'delete:', keyEquivalent: '')
|
44
|
+
addItemWithTitle('Select All', action: 'selectAll:', keyEquivalent: 'a')
|
45
|
+
end
|
46
|
+
|
47
|
+
fontMenu = createMenu('Font') do
|
48
|
+
addItemWithTitle('Show Fonts', action: 'orderFrontFontPanel:', keyEquivalent: 't')
|
49
|
+
addItemWithTitle('Bold', action: 'addFontTrait:', keyEquivalent: 'b')
|
50
|
+
addItemWithTitle('Italic', action: 'addFontTrait:', keyEquivalent: 'b')
|
51
|
+
addItemWithTitle('Underline', action: 'underline:', keyEquivalent: 'u')
|
52
|
+
addItem(NSMenuItem.separatorItem)
|
53
|
+
addItemWithTitle('Bigger', action: 'modifyFont:', keyEquivalent: '+')
|
54
|
+
addItemWithTitle('Smaller', action: 'modifyFont:', keyEquivalent: '-')
|
55
|
+
end
|
56
|
+
|
57
|
+
textMenu = createMenu('Text') do
|
58
|
+
addItemWithTitle('Align Left', action: 'alignLeft:', keyEquivalent: '{')
|
59
|
+
addItemWithTitle('Center', action: 'alignCenter:', keyEquivalent: '|')
|
60
|
+
addItemWithTitle('Justify', action: 'alignJustified:', keyEquivalent: '')
|
61
|
+
addItemWithTitle('Align Right', action: 'alignRight:', keyEquivalent: '}')
|
62
|
+
addItem(NSMenuItem.separatorItem)
|
63
|
+
addItemWithTitle('Show Ruler', action: 'toggleRuler:', keyEquivalent: '')
|
64
|
+
addItemWithTitle('Copy Ruler', action: 'copyRuler:', keyEquivalent: 'c')
|
65
|
+
addItemWithTitle('Paste Ruler', action: 'pasteRuler:', keyEquivalent: 'v')
|
66
|
+
end
|
67
|
+
|
68
|
+
addMenu('Format') do
|
69
|
+
addItem fontMenu
|
70
|
+
addItem textMenu
|
71
|
+
end
|
72
|
+
|
73
|
+
addMenu('View') do
|
74
|
+
item = addItemWithTitle('Show Toolbar', action: 'toggleToolbarShown:', keyEquivalent: 't')
|
75
|
+
item.keyEquivalentModifierMask = NSCommandKeyMask|NSAlternateKeyMask
|
76
|
+
addItemWithTitle('Customize Toolbar…', action: 'runToolbarCustomizationPalette:', keyEquivalent: '')
|
77
|
+
end
|
78
|
+
|
79
|
+
NSApp.windowsMenu = addMenu('Window') do
|
80
|
+
addItemWithTitle('Minimize', action: 'performMiniaturize:', keyEquivalent: 'm')
|
81
|
+
addItemWithTitle('Zoom', action: 'performZoom:', keyEquivalent: '')
|
82
|
+
addItem(NSMenuItem.separatorItem)
|
83
|
+
addItemWithTitle('Bring All To Front', action: 'arrangeInFront:', keyEquivalent: '')
|
84
|
+
end.menu
|
85
|
+
|
86
|
+
NSApp.helpMenu = addMenu('Help') do
|
87
|
+
addItemWithTitle("#{appName} Help", action: 'showHelp:', keyEquivalent: '?')
|
88
|
+
end.menu
|
89
|
+
|
90
|
+
NSApp.mainMenu = @mainMenu
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def addMenu(title, &b)
|
96
|
+
item = createMenu(title, &b)
|
97
|
+
@mainMenu.addItem item
|
98
|
+
item
|
99
|
+
end
|
100
|
+
|
101
|
+
def createMenu(title, &b)
|
102
|
+
menu = NSMenu.alloc.initWithTitle(title)
|
103
|
+
menu.instance_eval(&b) if b
|
104
|
+
item = NSMenuItem.alloc.initWithTitle(title, action: nil, keyEquivalent: '')
|
105
|
+
item.submenu = menu
|
106
|
+
item
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
|
2
|
+
{\colortbl;\red255\green255\blue255;}
|
3
|
+
\paperw9840\paperh8400
|
4
|
+
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
|
5
|
+
|
6
|
+
\f0\b\fs24 \cf0 Engineering:
|
7
|
+
\b0 \
|
8
|
+
Some people\
|
9
|
+
\
|
10
|
+
|
11
|
+
\b Human Interface Design:
|
12
|
+
\b0 \
|
13
|
+
Some other people\
|
14
|
+
\
|
15
|
+
|
16
|
+
\b Testing:
|
17
|
+
\b0 \
|
18
|
+
Hopefully not nobody\
|
19
|
+
\
|
20
|
+
|
21
|
+
\b Documentation:
|
22
|
+
\b0 \
|
23
|
+
Whoever\
|
24
|
+
\
|
25
|
+
|
26
|
+
\b With special thanks to:
|
27
|
+
\b0 \
|
28
|
+
Mom\
|
29
|
+
}
|
@@ -7,7 +7,11 @@ describe BubbleWrap::App do
|
|
7
7
|
|
8
8
|
describe '.resources_path' do
|
9
9
|
it 'should end in "/testSuite.app"' do
|
10
|
-
App.
|
10
|
+
if App.osx?
|
11
|
+
App.resources_path.should =~ /\/testSuite(_spec)?.app\/Contents\/Resources$/
|
12
|
+
else
|
13
|
+
App.resources_path.should =~ /\/testSuite(_spec)?.app$/
|
14
|
+
end
|
11
15
|
end
|
12
16
|
end
|
13
17
|
|
@@ -23,119 +27,6 @@ describe BubbleWrap::App do
|
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
26
|
-
describe '.alert' do
|
27
|
-
after do
|
28
|
-
@alert.dismissWithClickedButtonIndex(@alert.cancelButtonIndex, animated: false)
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "with only one string argument" do
|
32
|
-
before do
|
33
|
-
@alert = App.alert('1.21 Gigawatts!')
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'returns an alert' do
|
37
|
-
@alert.class.should == UIAlertView
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'is displaying the correct title' do
|
41
|
-
@alert.title.should == '1.21 Gigawatts!'
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'cancelButton' do
|
45
|
-
it 'is present' do
|
46
|
-
@alert.cancelButtonIndex.should == 0
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'has the correct title' do
|
50
|
-
@alert.buttonTitleAtIndex(@alert.cancelButtonIndex).should == 'OK'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "with only two string arguments" do
|
56
|
-
before do
|
57
|
-
@alert = App.alert('1.21 Gigawatts!', 'Great Scott!')
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'returns an alert' do
|
61
|
-
@alert.class.should == UIAlertView
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'is displaying the correct title' do
|
65
|
-
@alert.title.should == '1.21 Gigawatts!'
|
66
|
-
end
|
67
|
-
|
68
|
-
describe 'cancelButton' do
|
69
|
-
it 'is present' do
|
70
|
-
@alert.cancelButtonIndex.should == 0
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'has the correct title' do
|
74
|
-
@alert.buttonTitleAtIndex(@alert.cancelButtonIndex).should == 'Great Scott!'
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe "with variable args" do
|
80
|
-
before do
|
81
|
-
@alert = App.alert('1.21 Gigawatts!', cancel_button_title: 'Great Scott!',
|
82
|
-
message: 'Some random message')
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'returns an alert' do
|
86
|
-
@alert.class.should == UIAlertView
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'is displaying the correct title' do
|
90
|
-
@alert.title.should == '1.21 Gigawatts!'
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'is displaying the correct message' do
|
94
|
-
@alert.message.should == 'Some random message'
|
95
|
-
end
|
96
|
-
|
97
|
-
describe 'cancelButton' do
|
98
|
-
it 'is present' do
|
99
|
-
@alert.cancelButtonIndex.should == 0
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'has the correct title' do
|
103
|
-
@alert.buttonTitleAtIndex(@alert.cancelButtonIndex).should == 'Great Scott!'
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe "with a block" do
|
109
|
-
before do
|
110
|
-
@alert = App.alert('1.21 Gigawatts!') do |alert|
|
111
|
-
alert.message = 'My message!!'
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'returns an alert' do
|
116
|
-
@alert.class.should == UIAlertView
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'is displaying the correct title' do
|
120
|
-
@alert.title.should == '1.21 Gigawatts!'
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'is displaying the correct message' do
|
124
|
-
@alert.message.should == 'My message!!'
|
125
|
-
end
|
126
|
-
|
127
|
-
describe 'cancelButton' do
|
128
|
-
it 'is present' do
|
129
|
-
@alert.cancelButtonIndex.should == 0
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'has the correct title' do
|
133
|
-
@alert.buttonTitleAtIndex(@alert.cancelButtonIndex).should == 'OK'
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
30
|
describe '.states' do
|
140
31
|
it 'returns a hash' do
|
141
32
|
App.states.class.should == Hash
|
@@ -163,37 +54,6 @@ describe BubbleWrap::App do
|
|
163
54
|
end
|
164
55
|
end
|
165
56
|
|
166
|
-
describe '.frame' do
|
167
|
-
it 'returns Application Frame' do
|
168
|
-
App.frame.should == UIScreen.mainScreen.applicationFrame
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
describe '.bounds' do
|
173
|
-
it 'returns Main Screen bounds' do
|
174
|
-
App.bounds.should == UIScreen.mainScreen.bounds
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
|
179
|
-
describe '.delegate' do
|
180
|
-
it 'returns a TestSuiteDelegate' do
|
181
|
-
App.delegate.should == UIApplication.sharedApplication.delegate
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
describe '.shared' do
|
186
|
-
it 'returns UIApplication.sharedApplication' do
|
187
|
-
App.shared.should == UIApplication.sharedApplication
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe '.window' do
|
192
|
-
it 'returns UIApplication.sharedApplication.keyWindow' do
|
193
|
-
App.window.should == UIApplication.sharedApplication.keyWindow
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
57
|
describe '.run_after' do
|
198
58
|
class DelayedRunAfterTest; attr_accessor :test_value end
|
199
59
|
|
@@ -208,25 +68,6 @@ describe BubbleWrap::App do
|
|
208
68
|
|
209
69
|
end
|
210
70
|
|
211
|
-
describe ".open_url" do
|
212
|
-
|
213
|
-
it "uses NSURL or converts NSString in NSURL and opens it" do
|
214
|
-
application = UIApplication.sharedApplication
|
215
|
-
def application.url; @url end
|
216
|
-
def application.openURL(url); @url = url end
|
217
|
-
|
218
|
-
url = NSURL.URLWithString('http://localhost')
|
219
|
-
App.open_url(url)
|
220
|
-
application.url.should.equal url
|
221
|
-
|
222
|
-
url = 'http://localhost'
|
223
|
-
App.open_url(url)
|
224
|
-
application.url.class.should.equal NSURL
|
225
|
-
application.url.description.should.equal url
|
226
|
-
end
|
227
|
-
|
228
|
-
end
|
229
|
-
|
230
71
|
describe ".environment" do
|
231
72
|
|
232
73
|
it 'returns current application environment' do
|