mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
support for permalink and external url
Consolidate GetURL AppleEvent handling into AppDelegate+Scriptability file Add scripting access groups to sdef Add exists command Add ‘permalink’ and ‘external url’ properties to the article scripting object Add a unit test to verify the behavior of ‘current article’
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
property uparrowKeyCode : 126
|
||||
property downarrowKeyCode : 125
|
||||
property rightarrowKeyCode : 124
|
||||
property leftarrowKeyCode : 123
|
||||
|
||||
to activateEvergreen()
|
||||
tell application "Evergreen"
|
||||
activate
|
||||
end tell
|
||||
end activateEvergreen
|
||||
|
||||
to multipleKeyCodes(keycode, numberOfKeys)
|
||||
tell application "System Events"
|
||||
tell process "Evergreen"
|
||||
repeat numberOfKeys times
|
||||
key code keycode
|
||||
end repeat
|
||||
end tell
|
||||
end tell
|
||||
end multipleKeyCodes
|
||||
|
||||
to establishMainWindowStartingState()
|
||||
activateEvergreen()
|
||||
multipleKeyCodes(downarrowKeyCode, 2)
|
||||
multipleKeyCodes(rightarrowKeyCode, 2)
|
||||
multipleKeyCodes(leftarrowKeyCode, 2)
|
||||
multipleKeyCodes(uparrowKeyCode, 50)
|
||||
end establishMainWindowStartingState
|
||||
|
||||
try
|
||||
establishMainWindowStartingState()
|
||||
-- hit the down arrow a few times to get into the feeds
|
||||
on error message
|
||||
return {test_result:false, script_result:message}
|
||||
end try
|
||||
|
||||
return {test_result:true, script_result:"established starting state"}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
property uparrowKeyCode : 126
|
||||
property downarrowKeyCode : 125
|
||||
property rightarrowKeyCode : 124
|
||||
property leftarrowKeyCode : 123
|
||||
|
||||
to activateEvergreen()
|
||||
tell application "Evergreen"
|
||||
activate
|
||||
end tell
|
||||
end activateEvergreen
|
||||
|
||||
to multipleKeyCodes(keycode, numberOfKeys)
|
||||
tell application "System Events"
|
||||
tell process "Evergreen"
|
||||
repeat numberOfKeys times
|
||||
key code keycode
|
||||
end repeat
|
||||
end tell
|
||||
end tell
|
||||
end multipleKeyCodes
|
||||
|
||||
try
|
||||
activateEvergreen()
|
||||
multipleKeyCodes(downarrowKeyCode, 9)
|
||||
multipleKeyCodes(uparrowKeyCode, 1)
|
||||
on error message
|
||||
return {test_result:false, script_result:message}
|
||||
end try
|
||||
|
||||
return {test_result:true, script_result:"selected feed"}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
property uparrowKeyCode : 126
|
||||
property downarrowKeyCode : 125
|
||||
property rightarrowKeyCode : 124
|
||||
property leftarrowKeyCode : 123
|
||||
|
||||
to activateEvergreen()
|
||||
tell application "Evergreen"
|
||||
activate
|
||||
end tell
|
||||
end activateEvergreen
|
||||
|
||||
to multipleKeyCodes(keycode, numberOfKeys)
|
||||
tell application "System Events"
|
||||
tell process "Evergreen"
|
||||
repeat numberOfKeys times
|
||||
key code keycode
|
||||
end repeat
|
||||
end tell
|
||||
end tell
|
||||
end multipleKeyCodes
|
||||
|
||||
try
|
||||
activateEvergreen()
|
||||
multipleKeyCodes(rightarrowKeyCode, 1)
|
||||
on error message
|
||||
return {test_result:false, script_result:message}
|
||||
end try
|
||||
|
||||
return {test_result:true, script_result:"selected an article"}
|
||||
@@ -0,0 +1,23 @@
|
||||
-- this script tests that it is possible to get the url property of the current article
|
||||
-- it uses system event accessibility scripting to set up the main window
|
||||
-- one needs to authorize scripting accessibility control in the System Preferences'
|
||||
-- Privacy and security pane
|
||||
|
||||
try
|
||||
tell application "Evergreen"
|
||||
set shouldBeMissingValue to current article
|
||||
end tell
|
||||
|
||||
--verify that the current article is in fact 'missing vcalue'
|
||||
if shouldBeMissingValue is missing value then
|
||||
set the_message to "passed tests"
|
||||
set the_result to true
|
||||
else
|
||||
set the_message to "expected current article to be 'missing value'"
|
||||
set the_result to false
|
||||
end if
|
||||
on error message
|
||||
return {test_result:false, script_result:message}
|
||||
end try
|
||||
|
||||
return {test_result:the_result, script_result:the_message}
|
||||
@@ -0,0 +1,14 @@
|
||||
-- this script tests that it is possible to get the url property of the current article
|
||||
-- it uses system event accessibility scripting to set up the main window
|
||||
-- one needs to authorize scripting accessibility control in the System Preferences'
|
||||
-- Privacy and security pane
|
||||
|
||||
try
|
||||
tell application "Evergreen"
|
||||
{url, permalink, external url} of current article
|
||||
end tell
|
||||
on error message
|
||||
return {test_result:false, script_result:message}
|
||||
end try
|
||||
|
||||
return {test_result:true, script_result:"tests passed"}
|
||||
@@ -0,0 +1,18 @@
|
||||
-- this script sets up Evergreen so it is ready to be tested
|
||||
-- to get a current article
|
||||
|
||||
to activateEvergreen()
|
||||
tell application "Evergreen"
|
||||
activate
|
||||
end tell
|
||||
end activateEvergreen
|
||||
|
||||
tell application "System Events"
|
||||
set isFrontmost to frontmost of process "Evergreen"
|
||||
repeat while isFrontmost is false
|
||||
my activateEvergreen()
|
||||
set isFrontmost to frontmost of process "Evergreen"
|
||||
end repeat
|
||||
end tell
|
||||
|
||||
return {test_result:true, script_result:"finished"}
|
||||
Reference in New Issue
Block a user