Add and fix the test files

This commit is contained in:
Namhyeon Go 2024-06-02 02:00:17 +09:00
parent b193fadd72
commit 5f5386765d
6 changed files with 93 additions and 28 deletions

BIN
data/example.pptx Normal file

Binary file not shown.

View File

@ -1,11 +1,13 @@
{
"description": "WelsonJS test profile (test-misc.json)",
"date": "2024-01-04",
"revision": "HEAD",
"released": "2024-01-04",
"dependencies": {
"welsonjs": "0.2.7"
}
"authors": [
"Namhyeon Go <gnh1201@gmail.com>"
],
"links": [
"references": [
"https://github.com/gnh1201/welsonjs",
"https://catswords.social/@catswords_oss"
],
@ -31,7 +33,7 @@
"chatgpt"
],
"schema": {
"version": "0.1"
"version": "0.2"
},
"tests": [
{

View File

@ -1,11 +1,13 @@
{
"description": "WelsonJS test profile for Microsoft Office",
"date": "2023-12-19",
"revision": "20231219r1",
"released": "2024-06-02",
"dependencies": {
"welsonjs": "0.2.7"
}
"authors": [
"Namhyeon Go <gnh1201@gmail.com>"
],
"links": [
"references": [
"https://github.com/gnh1201/welsonjs",
"https://catswords.social/@catswords_oss"
],
@ -31,7 +33,7 @@
"chatgpt"
],
"schema": {
"version": "0.1"
"version": "0.2"
},
"tests": [
{
@ -39,6 +41,11 @@
"description": "마이크로소프트 엑셀 파일 열기 및 편집 가능 여부 확인",
"tags": ["Office", "Excel"]
},
{
"id": "open_excel_new",
"description": "마이크로소프트 엑셀 새로운 파일로 진행 가능 여부 확인",
"tags": ["Office", "Excel"]
},
{
"id": "open_excel_with_chatgpt",
"description": "마이크로소프트 엑셀 파일 열기 및 ChatGPT를 이용한 편집 가능 여부 확인",
@ -49,6 +56,11 @@
"description": "마이크로소프트 파워포인트 파일 열기 및 편집 가능 여부 확인",
"tags": ["Office", "PowerPoint"]
},
{
"id": "open_powerpoint_new",
"description": "마이크로소프트 파워포인트 새로운 파일로 진행 가능 여부 확인",
"tags": ["Office", "PowerPoint"]
},
{
"id": "open_word_file",
"description": "마이크로소프트 워드 파일 열기 및 편집 가능 여부 확인",

View File

@ -1,13 +1,16 @@
{
"description": "WelsonJS test profile for OSS contest 2023 in Republic of Korea",
"date": "2023-10-30",
"revision": "20231030r2",
"description": "2023 South Korea OSS Contest Test Profile for WelsonJS",
"released": "2023-10-30",
"dependencies": {
"welsonjs": "0.2.7"
}
"authors": [
"Namhyeon Go <gnh1201@gmail.com>"
],
"links": [
"references": [
"https://github.com/gnh1201/welsonjs",
"https://catswords.social/@catswords_oss"
"https://catswords.social/@catswords_oss",
"https://www.oss.kr/dev_competition_activities/show/544723e6-850a-4956-9194-79640420c19a"
],
"tags": [
"javascript",
@ -31,7 +34,7 @@
"chatgpt"
],
"schema": {
"version": "0.1"
"version": "0.2"
},
"tests": [
{

View File

@ -70,9 +70,6 @@ function Excel() {
} else {
this.currentWorksheet = this.currentWorkbook.Worksheets(idx);
}
console.log(typeof this.currentWorksheet);
return this;
};
@ -120,7 +117,12 @@ function PowerPoint() {
console.info("Microsoft Office PowerPoint", this.version);
this.currentPresentation = null;
this.open = function(filename) {
console.log("test");
console.log(typeof filename);
if (typeof filename !== "undefined") {
// check type of the path
if (filename.indexOf(":\\") < 0 && filename.indexOf(":/") < 0) {
@ -128,14 +130,44 @@ function PowerPoint() {
}
if (FILE.fileExists(filename)) {
console.info("FOUND", filename);
this.application.Presentations.Open(filename);
this.currentPresentation = this.application.ActivePresentation;
} else {
console.warn("NOT FOUND", filename);
this.currentPresentation = this.application.Presentations.Add(true);
}
} else {
this.currentPresentation = this.application.Presentations.Add(true);
}
};
this.selectPresentation = function(idx) {
if (idx == 0) {
this.currentWorksheet = this.application.ActivePresentation;
} else {
this.currentWorksheet = this.application.Presentations(idx);
}
return this;
};
// get all slides
this.getSlides = function() {
var slides = [];
var slideEnum = new Enumerator(this.currentPresentation.Slides);
for (; !slideEnum.atEnd(); slideEnum.moveNext()) {
slides.push(new PowerPoint.Slide(slideEnum.item()));
}
return slides;
};
}
PowerPoint.Slide = function(slide) {
this.slide = slide;
this.getShapes = function() {
// todo
};
};
PowerPoint.Shape = function(shape) {
this.shape = shape;

View File

@ -7,7 +7,7 @@ var FILE = require("lib/file");
// implement the tests
var test_implements = {
// Ref 1: https://gist.github.com/CityRay/c56e4fa874af9370cc1a367bd43095b0
// https://gist.github.com/CityRay/c56e4fa874af9370cc1a367bd43095b0
"es5_polyfills": function() {
var parseIntIgnoresLeadingZeros = (function () {
return parseInt('010', 10) === 10;
@ -26,7 +26,7 @@ var test_implements = {
"ECMAScript 5 수준의 런타임이 아닙니다. 필수 테스트 중 하나를 실패하였습니다.");
},
// Ref 1: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/regprov/stdregprov
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/regprov/stdregprov
"registry_find_provider": function() {
var REG = require("lib/registry");
@ -763,7 +763,7 @@ var test_implements = {
}
},
// profile: data/test-misc-20231107.json
// profile: data/test-misc.json
"toolkit_msedge_test": function() {
var Chrome = require("lib/chrome");
var Toolkit = require("lib/toolkit");
@ -777,7 +777,7 @@ var test_implements = {
Toolkit.sendClick("Google", 30, 30, 1);
},
// profile: data/test-misc-20231107.json
// profile: data/test-misc.json
"squel_sqlmap_test": function() {
console.log(squel.select({ separator: "\n" })
.from("students")
@ -789,11 +789,19 @@ var test_implements = {
.toString());
},
// profile: data/test-msoffice-20231219.json
// profile: data/test-msoffice.json
"open_excel_file": function() {
var Office = require("lib/msoffice");
var excel = new Office.Excel(); // Create an Excel instance
excel.open("data\\example.xlsx"); // Open the Excel window
var excel = new Office.Excel(); // Create a Excel instance
excel.open("data\\example.xlsx"); // Open a Excel window
},
"open_excel_new": function() {
var Office = require("lib/msoffice");
var excel = new Office.Excel(); // Create a Excel instance
excel.open(); // Open a Excel window
},
"open_excel_with_chatgpt": function() {
@ -829,9 +837,17 @@ var test_implements = {
},
"open_powerpoint_file": function() {
var Office = require("lib/msoffice"); // Load libraries
var Office = require("lib/msoffice");
var powerpoint = new Office.PowerPoint(); // Create a PowerPoint instance
powerpoint.open("data\\example.pptx"); // Open the PowerPoint window
powerpoint.open("data\\example.pptx"); // Open a PowerPoint window
},
"open_powerpoint_new": function() {
var Office = require("lib/msoffice");
var powerpoint = new Office.PowerPoint(); // Create a PowerPoint instance
powerpoint.open(); // Open a PowerPoint window
},
"open_word_file": function() {