//# ==++== //# //# //# Copyright (c) 2002 Microsoft Corporation. All rights reserved. //# //# The use and distribution terms for this software are contained in the file //# named license.txt, which can be found in the root of this distribution. //# By using this software in any fashion, you are agreeing to be bound by the //# terms of this license. //# //# You must not remove this notice, or any other, from this software. //# //# //# ==--== //#################################################################################### @cc_on import System; var NULL_DISPATCH = null; var apGlobalObj; var apPlatform; var lFailCount; var iTestID = 53232; // universal trim function // defaults to trimming tabs, newlines, and spaces. function trim (sIn, sTChars) { if (!sIn.length) return sIn; if (sTChars == undefined) sTChars = "\t\n "; var iSt=-1, iEnd=sIn.length; while ( ++iStiSt && sTChars.indexOf(sIn.charAt(iEnd)) != -1 ) {} return sIn.substring(iSt,iEnd+1); } // Equvilant to VBA's Chr function function chr (num) { if (num > 255 || num < 0) return null; var sHex = "0123456789abcdef"; return unescape( "%"+sHex.charAt(num>>4&0x0f)+sHex.charAt(num&0x0f) ); } // Equivilant to VBA's Asc function function asc (str) { // return parseInt( escape(str.charAt(0), 0).substring(1,3), 16 ); return str.charCodeAt(0); } // Returns a "proper form" string from the input string sIn. // The standard token delimiters are tab, newline, space, period, hypen, // comma, & double/single quotes. These can be overridden with the optional // opDlm parameter and added to if the opDlm param contains a '+' char // as the first char. function proper (sIn, opDlm) { var i; var std = "\t\n .-,\"\'"; if (opDlm == undefined) opDlm = std; var sDlm = opDlm.charAt(0)=='+' ? std+opDlm.substring(1,opDlm.length) : opDlm; var ch, ich=0, cb=sIn.length, s=sIn.toLowerCase(); for (i=0; i=0) ich = i+1; else if (ich==i) s = s.substring(0,i)+ch.toUpperCase()+s.substring(i+1,cb); } return s; } // Equiv to VBA's String function function bldStr (cb, str) { if ( cb==undefined || 0 == cb || 0 == (""+str).length ) return ""; if ( str==undefined ) str = " "; var sBld = (str + ""); while (sBld.length * 2 < cb) sBld += sBld; if (sBld.length < cb) sBld += bldStr(cb - sBld.length, str); return sBld; } // Pads the base arg with as many pad arg's to make a string who's length is equal to n. // sPad is optional, if not present, a space is used by default. // Requires: bldStr function padStr (base, n, pad) { var cb = n - ("" + base).length; if (pad == undefined) pad = " "; if (cb > 0 ) return bldStr(cb, pad) + base; return ""+base; } // Formats a string into cbBlk sized sections, delimited by sPad, from the right // if fRight flag is set, from the left if not. All args are optional except sSrc. function fmtSBlock (sSrc, cbBlk, sPad, fRight) { var i; // Default parameters if (fRight == undefined) fRight = false; if (sPad == undefined) sPad = " "; if (cbBlk == undefined || 0==cbBlk) cbBlk = sSrc.length; var cbMod = fRight ? sSrc.length%cbBlk : 0; var sRet = sSrc.substring(0,cbMod); for (i=0; i 0) { if (cb == undefined) cb = 100; if (bfType == undefined) bfType = 0x01|0x02|0x04; var rgfWhichChars = new Array(256); for (i=1; i= 0) System.Environment.ExitCode = lFailCount; else System.Environment.ExitCode = 1; function apInitTest(stTestName) { lFailCount = 0; apGlobalObj = new Object(); apGlobalObj.apGetPlatform = function Funca() { return "Rotor" } apGlobalObj.LangHost = function Funcb() { return 1033;} apGlobalObj.apGetLangExt = function Funcc(num) { return "EN"; } apPlatform = apGlobalObj.apGetPlatform(); var sVer = "1.0"; //navigator.appVersion.toUpperCase().charAt(navigator.appVersion.toUpperCase().indexOf("MSIE")+5); apGlobalObj.apGetHost = function Funcp() { return "Rotor " + sVer; } print ("apInitTest: " + stTestName); } function apInitScenario(stScenarioName) {print( "\tapInitScenario: " + stScenarioName);} function apLogFailInfo(stMessage, stExpected, stActual, stBugNum) { lFailCount = lFailCount + 1; print ("***** FAILED:"); print ("\t\t" + stMessage); print ("\t\tExpected: " + stExpected); print ("\t\tActual: " + stActual); } function apGetLocale(){ return 1033; } function apWriteDebug(s) { print("dbg ---> " + s) } function apEndTest() {}