Continue rename to NetNewsWire.

This commit is contained in:
Brent Simmons
2018-08-28 22:18:24 -07:00
parent 062d531ed9
commit 141ae5cc2f
256 changed files with 816 additions and 518 deletions

View File

@@ -0,0 +1,37 @@
property uparrowKeyCode : 126
property downarrowKeyCode : 125
property rightarrowKeyCode : 124
property leftarrowKeyCode : 123
to activateNetNewsWire()
tell application "NetNewsWire"
activate
end tell
end activateNetNewsWire
to multipleKeyCodes(keycode, numberOfKeys)
tell application "System Events"
tell process "NetNewsWire"
repeat numberOfKeys times
key code keycode
end repeat
end tell
end tell
end multipleKeyCodes
to establishMainWindowStartingState()
activateNetNewsWire()
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"}

View File

@@ -0,0 +1,32 @@
property uparrowKeyCode : 126
property downarrowKeyCode : 125
property rightarrowKeyCode : 124
property leftarrowKeyCode : 123
to activateNetNewsWire()
tell application "NetNewsWire"
activate
end tell
end activateNetNewsWire
to multipleKeyCodes(keycode, numberOfKeys)
tell application "System Events"
tell process "NetNewsWire"
repeat numberOfKeys times
key code keycode
end repeat
end tell
end tell
end multipleKeyCodes
try
activateNetNewsWire()
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"}

View File

@@ -0,0 +1,31 @@
property uparrowKeyCode : 126
property downarrowKeyCode : 125
property rightarrowKeyCode : 124
property leftarrowKeyCode : 123
to activateNetNewsWire()
tell application "NetNewsWire"
activate
end tell
end activateNetNewsWire
to multipleKeyCodes(keycode, numberOfKeys)
tell application "System Events"
tell process "NetNewsWire"
repeat numberOfKeys times
key code keycode
end repeat
end tell
end tell
end multipleKeyCodes
try
activateNetNewsWire()
multipleKeyCodes(rightarrowKeyCode, 1)
on error message
return {test_result:false, script_result:message}
end try
return {test_result:true, script_result:"selected an article"}

View File

@@ -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 "NetNewsWire"
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}

View File

@@ -0,0 +1,10 @@
-- this script just tests that no error was generated from the script
try
tell application "NetNewsWire"
exists feed 1 of account 1
end tell
on error message
return {test_result:false, script_result:message}
end try
return {test_result:true}

View File

@@ -0,0 +1,10 @@
-- this script just tests that no error was generated from the script
try
tell application "NetNewsWire"
opml representation of feed 1 of account 1
end tell
on error message
return {test_result:false, script_result:message}
end try
return {test_result:true}

View File

@@ -0,0 +1,13 @@
-- NetNewsWire scripting unit tests expect a dictionary to be returned from a script
-- containing either
-- {test_result:true}
-- to indicate success or
-- {test_result:false}
-- to indicate failure
-- Data can be passed back to unit test code by including a script_result field
-- for example this script returns "Geoducks!" as the result
-- this can be used as part of XCTest verification
-- see the testGenericScript() function in the ScriptingTests XCTestCase
return {test_result:true, script_result:"Geoducks!"}

View File

@@ -0,0 +1,19 @@
try
tell application "NetNewsWire"
open location "http://scripting.com/rss"
end tell
on error message
return {test_result:false, script_result:message}
end
-- open location is not expected to return a value
-- trying to access result should trigger an error, and that indicates a successful test
try
set getURLResult to the result
set testResult to false
on error message
set testResult to true
end try
return {test_result:testResult}

View File

@@ -0,0 +1,27 @@
try
tell application "NetNewsWire"
tell account id "OnMyMac"
repeat 3 times
set newFeed to make new feed with data "https://boingboing.net/feed"
delete newFeed
end repeat
set newFolder to make new folder with properties {name:"XCTest folder"}
repeat 3 times
set newFeed to make new feed in newFolder with data "https://boingboing.net/feed"
delete newFeed
end repeat
delete newFolder
end tell
end tell
set test_result to true
set script_result to "Success"
on error message
return {test_result:false, script_result:message}
end try
return {test_result:test_result, script_result:script_result}

View File

@@ -0,0 +1,10 @@
-- this script just tests that no error was generated from the script
try
tell application "NetNewsWire"
{name, url} of every feed of every account
end tell
on error message
return {test_result:false, script_result:message}
end try
return {test_result:true}

View File

@@ -0,0 +1,12 @@
-- this script just tests that no error was generated from the script
-- and that the returned list is greater than 0
try
tell application "NetNewsWire"
set namesResult to name of every author of every feed of every account
end tell
set test_result to ((count items of namesResult) > 0)
on error message
return {test_result:false, script_result:message}
end try
return {test_result:test_result}

View File

@@ -0,0 +1,11 @@
-- this script just tests that no error was generated from the script
try
tell application "NetNewsWire"
name of every folder of every account
end tell
on error message
return {test_result:false, script_result:message}
end try
return {test_result:true}

View File

@@ -0,0 +1,10 @@
-- this script just tests that no error was generated from the script
try
tell application "NetNewsWire"
title of every article of feed "Six Colors" where read is true
end tell
on error message
return {test_result:false, script_result:message}
end try
return {test_result:true}

View File

@@ -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 "NetNewsWire"
{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"}

View File

@@ -0,0 +1,18 @@
-- this script sets up NetNewsWire so it is ready to be tested
-- to get a current article
to activateNetNewsWire()
tell application "NetNewsWire"
activate
end tell
end activateNetNewsWire
tell application "System Events"
set isFrontmost to frontmost of process "NetNewsWire"
repeat while isFrontmost is false
my activateNetNewsWire()
set isFrontmost to frontmost of process "NetNewsWire"
end repeat
end tell
return {test_result:true, script_result:"finished"}