testPyScriptlet.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. function print(msg)
  2. {
  3. WScript.Echo(msg) ;
  4. }
  5. function check(condition, msg)
  6. {
  7. if (!condition) {
  8. print("***** testPyScriptlet.js failed *****");
  9. print(msg);
  10. }
  11. }
  12. var thisScriptEngine = ScriptEngine() ;
  13. var majorVersion = ScriptEngineMajorVersion() ;
  14. var minorVersion = ScriptEngineMinorVersion() ;
  15. var buildVersion = ScriptEngineBuildVersion() ;
  16. WScript.Echo(thisScriptEngine + " Version " + majorVersion + "." + minorVersion + " Build " + buildVersion) ;
  17. var scriptlet = new ActiveXObject("TestPys.Scriptlet") ;
  18. check(scriptlet.PyProp1=="PyScript Property1", "PyProp1 wasn't correct initial value");
  19. scriptlet.PyProp1 = "New Value";
  20. check(scriptlet.PyProp1=="New Value", "PyProp1 wasn't correct new value");
  21. check(scriptlet.PyProp2=="PyScript Property2", "PyProp2 wasn't correct initial value");
  22. scriptlet.PyProp2 = "Another New Value";
  23. check(scriptlet.PyProp2=="Another New Value", "PyProp2 wasn't correct new value");
  24. check(scriptlet.PyMethod1()=="PyMethod1 called", "Method1 wrong value");
  25. check(scriptlet.PyMethod2()=="PyMethod2 called", "Method2 wrong value");