Commit 65980530 authored by Bas Lijnse's avatar Bas Lijnse

Made all examples and tests compile again

parent 9f9d61fe
......@@ -496,12 +496,12 @@ addContactPhoto contactNo original
exportDocument (tmp</>"orig.jpg") original
>>- \_ ->
callProcess "Creating thumbnail..." [] CONVERT_BIN
["-define","jpeg:size=400x400",(tmp</>"orig.jpg"),"-thumbnail","200x200^","-gravity","center","-extent","200x200",(tmp</>"thumb.png")] Nothing
["-define","jpeg:size=400x400",(tmp</>"orig.jpg"),"-thumbnail","200x200^","-gravity","center","-extent","200x200",(tmp</>"thumb.png")] Nothing False
>>- \_ ->
importDocument (tmp</>"thumb.png")
>>- \thumb ->
callProcess "Creating avatar..." [] CONVERT_BIN
["-define","jpeg:size=100x100",(tmp</>"orig.jpg"),"-thumbnail","50x50^","-gravity","center","-extent","50x50",(tmp</>"avatar.png")] Nothing
["-define","jpeg:size=100x100",(tmp</>"orig.jpg"),"-thumbnail","50x50^","-gravity","center","-extent","50x50",(tmp</>"avatar.png")] Nothing False
>>- \_ ->
importDocument (tmp</>"avatar.png")
>>- \avatar -> let photo = {ContactPhoto|original = original, thumb = thumb, avatar = avatar} in
......
implementation module Incidone.Util.Workspace
import iTasks
import Data.Maybe
import qualified Data.Map as DM
doIndependent :: [Workspace -> Task ()] -> Task ()
......
......@@ -714,7 +714,7 @@ externalProcessExample =
enterInformation "Enter the path to the external process. To for instance open a shell run '/bin/bash' or 'c:\\Windows\\System32\\cmd.exe'." [] >>= \path ->
withShared
Nothing
( \sds -> ( externalProcess path [] Nothing sds True handlers <<@ ApplyLayout (removeSubUIs (SelectByPath [])) >&>
( \sds -> ( externalProcess () path [] Nothing sds True handlers gEditor{|*|} <<@ ApplyLayout (removeSubUIs (SelectByPath [])) >&>
viewSharedInformation "Process output" []
) -&&-
forever (enterInformation "Enter data to send to StdIn" [] >>= \data -> set (Just (data +++ "\n")) sds)
......
......@@ -15,7 +15,7 @@ Start world = execTestSuite (testsuite "UIs of core tasks" "Tests for UI behavio
//Currently only tested on unix systems
testCallFastProcess = IF_WINDOWS (pass "Test call for fast process") (testTaskOutput "Test call fast process" tut events exp checkEqual)
where
tut = callProcess "Run fast process" [] "/bin/date" [] Nothing
tut = callProcess "Run fast process" [] "/bin/date" [] Nothing False
events = [Left ResetEvent,Right 1,Left (RefreshEvent 'DS'.newSet "Update")]
exp = [ReplaceUI initialUI,ReplaceUI finishedUI]
......@@ -24,7 +24,7 @@ where
testCallSlowProcess = IF_WINDOWS (pass "Test call for slow process") (testTaskOutput "Test call slow process" tut events exp checkEqual)
where
tut = callProcess "Run slow process" [] "/bin/sleep" ["2"] Nothing
tut = callProcess "Run slow process" [] "/bin/sleep" ["2"] Nothing False
events = [Left ResetEvent,Right 1,Left (RefreshEvent 'DS'.newSet "Update"),Right 2,Left (RefreshEvent 'DS'.newSet "Update"),Left (RefreshEvent 'DS'.newSet "Update")]
exp = [ReplaceUI initialUI, ReplaceUI finishedUI]
......
......@@ -10,20 +10,66 @@ from iTasks.Internal.Util import toCanonicalPath
import iTasks.Internal.Serialization
import iTasks.UI.Definition
import qualified iTasks.Internal.SDS as SDS
import Text
import Text, Text.HTML
import System.Directory, System.FilePath
import Data.Either, Data.Error
import Data.Either, Data.Error, Data.Tuple
import qualified Data.Queue as DQ
import qualified Data.Map as DM
from Data.Queue import :: Queue(..)
import System.CommandLine
import Tests.Common.MinimalTasks
derive gText Queue
derive gEq Queue
derive gPrettyTrace UIChange, UIChildChange, UIAttributeChange, UI, UIType, JSONNode, MaybeError
minimalEditor :: Task String
minimalEditor = updateInformation "Minimal String editor" [] "Hello World"
minimalEditlet :: Task String
minimalEditlet = updateInformation "Minimal String editlet" [UpdateUsing id const editor] "Hello World"
where
//Simple button
editor = { Editor
| genUI = withClientSideInit (\m w -> w) genUI
, onEdit = \_ _ n msk ust -> (Ok (NoChange,msk),n,ust)
, onRefresh = \_ n o m vst -> (Ok (if (o == n) NoChange (ChangeUI [SetAttribute "value" (toJSON n)] []),m),n,vst)
}
genUI dp val world
= (Ok (uia UIHtmlView ('DM'.unions [sizeAttr WrapSize WrapSize, valueAttr (JSONString (toString (html "DEPRECATED")))]),newFieldMask), world)
html cid = ButtonTag [IdAttr (cid +++ "-button")] [Text "Click me"]
minimalStep :: Task String
minimalStep = enterInformation "Minimal Step combinator" []
>>* [OnAction ActionOk (hasValue (updateInformation "Result" []))]
minimalParallel :: Task (String,String)
minimalParallel = updateInformation "Edit string 1" [] "A"
-&&- updateInformation "Edit string 2" [] "B"
//Minimal task to test adding and removing tasks from a parallel
minimalParallelOperations :: Task [Int]
minimalParallelOperations
= parallel [(Embedded,editItem 0)] [pushAction,popAction] @? \(Value items s) -> Value [i \\ (_,Value i _) <- items] s
where
editItem i list = updateInformation ("INITIAL: "<+++ i) [] i
//Add an item
pushAction = OnAction (Action "Push") (hasValue (\list -> (Embedded,editItem (length list))))
//Remove the last item
popAction = OnAction (Action "Pop") (ifValue (\list -> not (isEmpty list)) (const (Embedded, popItem)))
popItem list //Kinda ugly that we need to add a task to remove one...
= get (sdsFocus filter list) @ appSnd reverse
>>- \(_,[remover,topofstack:_]) -> //We want to remove the one that was originally last, and the current task
removeTask remover.TaskListItem.taskId list -&&- removeTask topofstack.TaskListItem.taskId list
@? const NoValue
where
filter = {onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False,includeValue=False,includeAttributes=False,includeProgress=False}
minimalForever :: Task String
minimalForever = forever (viewInformation () [] "Forever..." >>= return)
Start world = execTestSuite (testsuite "Task evaluation" "Tests to verify properties of task evaluation"
[testInitIWorld
,testCreateTaskInstance
......
......@@ -55,7 +55,7 @@ runInteractiveTests
= ( editSelectionWithShared (Title "Select test") False (SelectInTree collectionToTree selectTest) tests (const []) @? tvHd
>&> withSelection (viewInformation () [] "Select a test") testInteractive ) <<@ ArrangeWithSideBar 0 LeftSide 250 True @! ()
where
tests = sdsFocus INTERACTIVE_TESTS_PATH (fileCollection (\path isDirectory -> isDirectory || takeExtension path == "icl"))
tests = sdsFocus INTERACTIVE_TESTS_PATH (fileCollection (\path isDirectory -> isDirectory || takeExtension path == "icl") False)
collectionToTree collection = itemsToTree [] collection
where
......@@ -228,7 +228,7 @@ where
>>- maybe (throw "Cannot run the program. There is no executable yet")
(\executable ->
makeExecutable executable
>>- \_ -> callProcess () [] executable ["-port","8084"] (Just temporaryDirectory) True
>>- \_ -> callProcess () [] executable ["-port","8084"] (Just temporaryDirectory) False
>>* [OnAction ActionClose (always (return ()))] //Pause after command...
)
) @! ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment