act*24322

subroutine act24322

* the problem is after changing the template file name, the new name

* is not retrieved by w3TemplateFileName also confirm that the correct

* template file is being used

include wbp w3include           

bpName = "bp"

w3HtmlName= "w3html"

setname = ""

status  = ""

msg     = ""

 

* set a new name

call w3templatefileChange(bpName, status)

if status # w3_OK then

   msg<-1> = "Failed, test 1, could not change template to ":bpName

end

* get the new name & verify it is correct

call w3TemplateFileName(setname)

if setname # bpName then

   msg<-1> = "Failed, test 2, new name not set to: ":bpname

end

* w3CommCaptureItem is an internal structure which may or may

* not be supported in future releases of FlashCONNECT. Do not use it

* withing an application. It's use here is only for internal testing

* purposes.

* verify that the templates are being read from the correct file

* by looking for existing and non-existing templates from two

* different template files.

* clear the current page being processed between tests

* clear the cached template between tests        

systemName = "system.headfoot.htm"

cookie1Name = "cookie1"

call w3HtmlClear      

call w3HtmlInsertFlush

* change back to the main template file

call w3TemplateFileChange(w3HtmlName, status)

if w3_OK # status then

   msg<-1> = "Failed: test 9, switch to w3html"

end

call w3HtmlInsert(systemName, "")

if "" = w3CommCaptureItem then

   msg<-1> = "Failed: test 3, could not read ":systemName:" from w3html"

end

call w3HtmlClear

call w3HtmlInsertFlush

call w3HtmlInsert(cookie1Name, "")

if "" # w3CommCaptureItem then

   msg<-1> = "Failed: test 4, read ":cookie1Name:" from w3html"

end

call w3Templatefilechange(bpName, status)

if w3_OK # status then

   msg<-1> = "Failed: test 10, switch to bp"

end

call w3HtmlClear

call w3HtmlInsertFlush

call w3HtmlInsert(systemName, "")

if "" # w3CommCaptureItem then

   msg<-1> = "Failed: test 5, could read ":systemName:" from bp"

end

call w3HtmlClear

call w3HtmlInsertFlush

call w3HtmlInsert(cookie1Name, "")

if "" = w3CommCaptureItem then

   msg<-1> = "Failed: test 6, could not read ":cookie1Name:" from bp"

end

* reset the name so the test can output results and confirm the

* switch back worked

call w3Templatefilechange(w3HtmlName, status)

if w3_OK # status then

   msg<-1> = "Failed: test 11, switch to w3html"

end

call w3HtmlClear

call w3HtmlInsertFlush

call w3HtmlInsert(systemName, "")

if "" = w3CommCaptureItem then

   msg<-1> = "Failed: test 7, could not read ":systemName:" from w3html"

end

call w3HtmlClear

call w3HtmlInsertFlush

call w3HtmlInsert(cookie1Name, "")

if "" # w3CommCaptureItem then

   msg<-1> = "Failed: test 8, read ":cookie1Name:" from w3html"

end

* reset the form to clear the pending output

call w3HtmlClear

call w3HtmlInsertFlush

* report results

if msg = "" then msg = "Passed"

subs     = "##TITLE##":@vm:"act24322"

subs<-1> = "##HEADLINE##":@vm:"Results"

call w3HtmlInit("", "")

call w3HtmlHeader("", subs)

cnt = dcount(msg, @am)

for i = 1 to cnt

    call w3Print('<P>': msg<i>)

next i

call w3HtmlFooter("","")

return