1
0
Fork 0

0.03-settings fixed, app 90% automated tested

master
Danny 2022-02-01 23:44:59 +01:00
parent ad7b0df2a1
commit 6e054468ab
4 changed files with 325 additions and 87 deletions

View File

@ -4655,7 +4655,7 @@
"name": "TimeCal",
"shortName":"TimeCal",
"icon": "icon.png",
"version":"0.02",
"version":"0.03",
"description": "TimeCal shows the Time along with a 3 week calendar",
"tags": "clock",
"readme":"README.md",

View File

@ -19,14 +19,14 @@ class TimeCalClock{
const defaults = {
shwDate:1, //0:none, 1:locale, 2:month, 3:monthshort.year #week
wdStrt:1, //identical to getDay() 0->Su, 1->Mo, ... //Issue #1154: weekstart So/Mo, -1 for use today
wdStrt:0, //identical to getDay() 0->Su, 1->Mo, ... //Issue #1154: weekstart So/Mo, -1 for use today
tdyNumClr:0, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
tdyNumClr:3, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
tdyMrkr:0, //0:none, 1:circle, 2:rectangle, 3:filled
tdyMrkClr:2, //1:red=#E00, 2:green=#0E0, 3:blue=#00E
tdyMrkPxl:3, //px
suClr:0, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
suClr:1, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
//phColor:"#E00", //public holiday
calBrdr:false
@ -41,7 +41,19 @@ class TimeCalClock{
this.centerX = Bangle.appRect.w/2;
this.nrgb = [g.theme.fg, "#E00", "#0E0", "#00E"]; //fg, r ,g , b
this.ABR_DAY = require("locale") && require("locale").abday ? require("locale").abday : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
this.ABR_DAY=[];
if (require("locale") && require("locale").dow)
for (let d=0; d<=6; d++) {
var refDay=new Date();
refDay.setFullYear(1972);
refDay.setMonth(0);
refDay.setDate(2+d);
this.ABR_DAY.push(require("locale").dow(refDay));
}
else
this.ABR_DAY=["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
}
/**
@ -57,7 +69,10 @@ class TimeCalClock{
**/
draw(){
this.drawTime();
}
if (this.TZOffset===undefined || this.TZOffset!==d.getTimezoneOffset())
this.drawDateAndCal();
}
/**
* draw given or current time from date
@ -77,10 +92,7 @@ class TimeCalClock{
g.drawString(("0" + require("locale").time(d, 1)).slice(-5), this.centerX, Y);
//.drawRect(Bangle.appRect.x, Y, Bangle.appRect.x2, Y+this.TIME_FONT_SIZE()-7); //DEV-Option
setTimeout(this.drawTime.bind(this), 60000-(d.getSeconds()*1000)-d.getMilliseconds());
if (this.TZOffset===undefined || this.TZOffset!==d.getTimezoneOffset())
this.drawDateAndCal();
this.TZOffset=d.getTimezoneOffset();
setTimeout(this.draw.bind(this), 60000-(d.getSeconds()*1000)-d.getMilliseconds());
}
/**
@ -90,11 +102,12 @@ class TimeCalClock{
drawDateAndCal(){
d=this.date ? this.date : new Date();
if (this.tOutD) //abort exisiting
clearTimeout(this.tOutD);
this.TZOffset=d.getTimezoneOffset();
this.drawDate();
this.drawCal();
if (this.tOutD) //abort exisiting
clearTimeout(this.tOutD);
this.tOutD=setTimeout(this.drawDateAndCal.bind(this), 86400000-(d.getHours()*24*60*1000)-(d.getMinutes()*60*1000)-d.getSeconds()-d.getMilliseconds());
}
@ -182,13 +195,15 @@ class TimeCalClock{
g.setFontAlign(-1, -1);
const tdyDate=d.getDate();
const sttngsWdStrt=this.settings().wdStrt>=0 ? this.settings().wdStrt : tdyDate.getDay();
//draw grid & Headline
const dNames = this.ABR_DAY.map((a) => a.length<=2 ? a : a.substr(0, 2)); //force shrt 2
for(var dNo=0; dNo<dNames.length; dNo++){
const dName=dNames[(dNo+sttngsWdStrt)%7];
const dIdx=this.settings().wdStrt>=0 ? (dNo+this.settings().wdStrt)%7 : (dNo+d.getDay()+4)%7;
const dName=dNames[dIdx];
if (dIdx==0) //sunday colorize txt
g.setColor(this.nrgb[this.settings().suClr]);
else
g.setColor(g.theme.fg);
g.drawString(dName, dNo*CELL_W+(CELL_W-g.stringWidth(dName))/2+2, CAL_Y+1); //center Names
if(dNo>0)
g.drawLine(dNo*CELL_W, CAL_Y, dNo*CELL_W, CAL_Y+CAL_AREA_H-1);
@ -204,8 +219,9 @@ class TimeCalClock{
g.setFont("Vector", DAY_NUM_FONT_SIZE);
//write days
const days=7+(7+d.getDay()-sttngsWdStrt)%7;//start day (week before=7 days + days in this week realtive to week start)
var rD=new Date();
const tdyDate=d.getDate();
const days=this.settings().wdStrt>=0 ? 7+((7+d.getDay()-this.settings().wdStrt)%7) : 10;//start day (week before=7 days + days in this week realtive to week start) or fixed 7+3 days
var rD=new Date(d.getTime());
rD.setDate(rD.getDate()-days);
var rDate=rD.getDate();
for(var y=0; y<3; y++){
@ -215,7 +231,7 @@ class TimeCalClock{
switch(this.settings().tdyMrkr){ //0:none, 1:circle, 2:rectangle, 3:filled
case 1:
for(m=1; m<=this.settings().tdyMrkPxl&&m<CELL_H-1&&m<CELL_W-1; m++)
g.drawCircle(x*CELL_W+(CELL_W/2), nextY+(CELL_H*y)+(CELL_H/2), Math.min((CELL_W-m)/2, (CELL_H-m)/2));
g.drawCircle(x*CELL_W+(CELL_W/2)+1, nextY+(CELL_H*y)+(CELL_H/2)+1, Math.min((CELL_W-m)/2, (CELL_H-m)/2)-2);
break;
case 2:
for(m=1; m<=this.settings().tdyMrkPxl&&m<CELL_H-1&&m<CELL_W-1; m++)
@ -228,8 +244,8 @@ class TimeCalClock{
break;
}
g.setColor(this.nrgb[this.settings().tdyNumClr]); //today color or fg color
}else if(this.settings().suColor && rD.getDay()==0){ //sundays
g.setColor(this.settings().suColor);
}else if(this.settings().suClr && rD.getDay()==0){ //sundays
g.setColor(this.nrgb[this.settings().suClr]);
}else{ //default
g.setColor(g.theme.fg);
}
@ -261,6 +277,5 @@ class TimeCalClock{
return Number(1 + Math.ceil((firstThursday - tdt) / 604800000));
}
}
timeCalClock = new TimeCalClock(); timeCalClock.draw();

View File

@ -19,14 +19,14 @@ class TimeCalClock{
const defaults = {
shwDate:1, //0:none, 1:locale, 2:month, 3:monthshort.year #week
wdStrt:1, //identical to getDay() 0->Su, 1->Mo, ... //Issue #1154: weekstart So/Mo, -1 for use today
wdStrt:0, //identical to getDay() 0->Su, 1->Mo, ... //Issue #1154: weekstart So/Mo, -1 for use today
tdyNumClr:0, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
tdyNumClr:3, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
tdyMrkr:0, //0:none, 1:circle, 2:rectangle, 3:filled
tdyMrkClr:2, //1:red=#E00, 2:green=#0E0, 3:blue=#00E
tdyMrkPxl:3, //px
suClr:0, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
suClr:1, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
//phColor:"#E00", //public holiday
calBrdr:false
@ -41,7 +41,19 @@ class TimeCalClock{
this.centerX = Bangle.appRect.w/2;
this.nrgb = [g.theme.fg, "#E00", "#0E0", "#00E"]; //fg, r ,g , b
this.ABR_DAY = require("locale") && require("locale").abday ? require("locale").abday : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
this.ABR_DAY=[];
if (require("locale") && require("locale").dow)
for (let d=0; d<=6; d++) {
var refDay=new Date();
refDay.setFullYear(1972);
refDay.setMonth(0);
refDay.setDate(2+d);
this.ABR_DAY.push(require("locale").dow(refDay));
}
else
this.ABR_DAY=["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
}
/**
@ -57,7 +69,10 @@ class TimeCalClock{
**/
draw(){
this.drawTime();
}
if (this.TZOffset===undefined || this.TZOffset!==d.getTimezoneOffset())
this.drawDateAndCal();
}
/**
* draw given or current time from date
@ -77,10 +92,7 @@ class TimeCalClock{
g.drawString(("0" + require("locale").time(d, 1)).slice(-5), this.centerX, Y);
//.drawRect(Bangle.appRect.x, Y, Bangle.appRect.x2, Y+this.TIME_FONT_SIZE()-7); //DEV-Option
setTimeout(this.drawTime.bind(this), 60000-(d.getSeconds()*1000)-d.getMilliseconds());
if (this.TZOffset===undefined || this.TZOffset!==d.getTimezoneOffset())
this.drawDateAndCal();
this.TZOffset=d.getTimezoneOffset();
setTimeout(this.draw.bind(this), 60000-(d.getSeconds()*1000)-d.getMilliseconds());
}
/**
@ -90,11 +102,12 @@ class TimeCalClock{
drawDateAndCal(){
d=this.date ? this.date : new Date();
if (this.tOutD) //abort exisiting
clearTimeout(this.tOutD);
this.TZOffset=d.getTimezoneOffset();
this.drawDate();
this.drawCal();
if (this.tOutD) //abort exisiting
clearTimeout(this.tOutD);
this.tOutD=setTimeout(this.drawDateAndCal.bind(this), 86400000-(d.getHours()*24*60*1000)-(d.getMinutes()*60*1000)-d.getSeconds()-d.getMilliseconds());
}
@ -182,13 +195,15 @@ class TimeCalClock{
g.setFontAlign(-1, -1);
const tdyDate=d.getDate();
const sttngsWdStrt=this.settings().wdStrt>=0 ? this.settings().wdStrt : tdyDate.getDay();
//draw grid & Headline
const dNames = this.ABR_DAY.map((a) => a.length<=2 ? a : a.substr(0, 2)); //force shrt 2
for(var dNo=0; dNo<dNames.length; dNo++){
const dName=dNames[(dNo+sttngsWdStrt)%7];
const dIdx=this.settings().wdStrt>=0 ? (dNo+this.settings().wdStrt)%7 : (dNo+d.getDay()+4)%7;
const dName=dNames[dIdx];
if (dIdx==0) //sunday colorize txt
g.setColor(this.nrgb[this.settings().suClr]);
else
g.setColor(g.theme.fg);
g.drawString(dName, dNo*CELL_W+(CELL_W-g.stringWidth(dName))/2+2, CAL_Y+1); //center Names
if(dNo>0)
g.drawLine(dNo*CELL_W, CAL_Y, dNo*CELL_W, CAL_Y+CAL_AREA_H-1);
@ -204,8 +219,9 @@ class TimeCalClock{
g.setFont("Vector", DAY_NUM_FONT_SIZE);
//write days
const days=7+(7+d.getDay()-sttngsWdStrt)%7;//start day (week before=7 days + days in this week realtive to week start)
var rD=new Date();
const tdyDate=d.getDate();
const days=this.settings().wdStrt>=0 ? 7+((7+d.getDay()-this.settings().wdStrt)%7) : 10;//start day (week before=7 days + days in this week realtive to week start) or fixed 7+3 days
var rD=new Date(d.getTime());
rD.setDate(rD.getDate()-days);
var rDate=rD.getDate();
for(var y=0; y<3; y++){
@ -215,7 +231,7 @@ class TimeCalClock{
switch(this.settings().tdyMrkr){ //0:none, 1:circle, 2:rectangle, 3:filled
case 1:
for(m=1; m<=this.settings().tdyMrkPxl&&m<CELL_H-1&&m<CELL_W-1; m++)
g.drawCircle(x*CELL_W+(CELL_W/2), nextY+(CELL_H*y)+(CELL_H/2), Math.min((CELL_W-m)/2, (CELL_H-m)/2));
g.drawCircle(x*CELL_W+(CELL_W/2)+1, nextY+(CELL_H*y)+(CELL_H/2)+1, Math.min((CELL_W-m)/2, (CELL_H-m)/2)-2);
break;
case 2:
for(m=1; m<=this.settings().tdyMrkPxl&&m<CELL_H-1&&m<CELL_W-1; m++)
@ -228,8 +244,8 @@ class TimeCalClock{
break;
}
g.setColor(this.nrgb[this.settings().tdyNumClr]); //today color or fg color
}else if(this.settings().suColor && rD.getDay()==0){ //sundays
g.setColor(this.settings().suColor);
}else if(this.settings().suClr && rD.getDay()==0){ //sundays
g.setColor(this.nrgb[this.settings().suClr]);
}else{ //default
g.setColor(g.theme.fg);
}
@ -260,8 +276,7 @@ class TimeCalClock{
}
return Number(1 + Math.ceil((firstThursday - tdt) / 604800000));
}
}
}
//*************************************************************************************
//*************************************************************************************
@ -280,7 +295,7 @@ class TimeCalClock{
WARNING: 3,
ERROR: 2,
EXCEPTION: 1
}
};
/**
* Exception: Mandatory Field not provided
@ -358,7 +373,7 @@ class TestSetting extends Test{
constructorParams: ["optional: <cpar1>","|TEST_SETTINGS|","..."], //TEST_SETTINGS will be replcaed with each current {setting: case}
functionNames: ["required, <function under test>", "..."],
functionParams: ["optional: <fpar1>","|TEST_SETTINGS|","..."]
}
};
}
constructor(data){
@ -375,7 +390,7 @@ class TestSetting extends Test{
afterExpression: entry.afterExpression||true
};
});
this.constructorParams = data.constructorParams,
this.constructorParams = data.constructorParams;
this.functionNames = data.functionNames;
this.functionParams = data.functionParams;
}
@ -440,14 +455,16 @@ class BangleTestRunner{
this._afterCase();
}
this._afterTest();
this._firstCase();
}
this._exit();
}
/**
* global prepare - before all test
*/
_init() {
console.log(new Date().getTime(),">>init");
console.log(this._nowTime(), ">>init");
this.currentTestNum=-1;
this.currentCaseNum=-1;
}
@ -456,72 +473,69 @@ class BangleTestRunner{
* before each test
*/
_beforeTest() {
console.log(new Date(),">>test #" + this.currentTestNum);
console.log(this._nowTime(), ">>test #" + this.currentTestNum);
}
/**
* befor each testcase
*/
_beforeCase() {
console.log(new Date(),">>case #" + this.currentTestNum + "." + this.currentCaseNum + "/" + (this.currentTest.cases.length-1));
if (this.currentTest instanceof TestSetting) {
console.log(
this.currentTest.setting + "="+this.currentCase.value+"\n"+
this.currentCase.beforeTxt ? "testcase: " + this.currentCase.beforeTxt : ""
console.log(this._nowTime(), ">>case #" + this.currentTestNum + "." + this.currentCaseNum + "/" + (this.currentTest.cases.length-1));
if (this.currentTest instanceof TestSetting)
console.log(this.currentTest.setting+"="+this.currentCase.value+"\n"
+this.currentCase.beforeTxt ? "testcase:"+this.currentCase.beforeTxt : ""
);
}
}
/**
* testcase runner
*/
_runCase() {
console.log(new Date(), ">>running...");
console.log(this._nowTime(), ">>running...");
var returns = [];
this.currentTest.functionNames.forEach((fName) => {
var settings={}; settings[this.currentTest.setting] = this.currentCase.value;
var cParams = this.currentTest.constructorParams||[];
cParams = cParams.map((v) => (v && v instanceof String && v==="|TEST_SETTINGS|") ? settings : v)//replace settings in call params
cParams = cParams.map((v) => (v && v instanceof String && v==="|TEST_SETTINGS|") ? settings : v);//replace settings in call params
var fParams = this.currentTest.functionParams||[];
fParams = fParams.map((v) => (v && v instanceof String && v==="|TEST_SETTINGS|") ? settings : v)//replace settings in call params
fParams = fParams.map((v) => (v && v instanceof String && v==="|TEST_SETTINGS|") ? settings : v);//replace settings in call params
var creatorFunc = new Function("return new " + this.oClass + "(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9])"); //prepare spwan arguments[0],arguments[1]
var creatorFunc = new Function("console.log('Constructor params:', arguments); return new " + this.oClass + "(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9])"); //prepare spwan arguments[0],arguments[1]
let instance = creatorFunc.call(this.oClass, cParams[0], cParams[1], cParams[2], cParams[3], cParams[4], cParams[5], cParams[6], cParams[7], cParams[8], cParams[9]); //spwan
console.log(">>"+this.oClass+"["+fName+"]()");
console.log('Instance:', instance);
console.log('Function params:', fParams);
returns.push(instance[fName](fParams[0], fParams[1], fParams[2], fParams[3], fParams[4], fParams[5], fParams[6], fParams[7], fParams[8], fParams[9])); //run method and store result
console.log("<<"+this.oClass+"["+fName+"]()");
g.dump();
console.log("<<"+this.oClass+"["+fName+"]()");
});
console.log(new Date(), "<<...running");
console.log(this._nowTime(), "<<...running");
}
/**
* after each testcase
*/
_afterCase() {
if (this.currentTest instanceof TestSetting) {
if (this.currentCase.afterTxt.length>0) {
console.log(
"--EXPECTED: " + this.currentCase.afterTxt
);
}
}
console.log(new Date(), "<<case #" + this.currentTestNum + "." + this.currentCaseNum + "/" + (this.currentTest.cases.length-1));
if (this.currentTest instanceof TestSetting)
if (this.currentCase.afterTxt.length>0)
console.log("++EXPECTED:" + this.currentCase.afterTxt + "EXPECTED++");
console.log(this._nowTime(), "<<case #" + this.currentTestNum + "." + this.currentCaseNum + "/" + (this.currentTest.cases.length-1));
}
/**
* after each test
*/
_afterTest() {
console.log(new Date(), "<<test #" + this.currentTestNum);
console.log(this._nowTime(), "<<test #" + this.currentTestNum);
}
/**
* after all tests
*/
_exit() {
console.log(new Date(), "<<exit");
console.log(this._nowTime(), "<<exit");
}
/**
@ -542,37 +556,246 @@ class BangleTestRunner{
_nextTest() {
if (this.currentTestNum>=-1 && (this.currentTestNum+1)<this.tests.length) {
this.currentTestNum++;
this.currentTest = this.tests[this.currentTestNum];
this.currentTestNum++; this.currentTest = this.tests[this.currentTestNum];
return true;
}
return false;
}
_firstCase() {
this.currentCaseNum=-1;
}
_nextCase() {
if (this.currentCaseNum>=-1 && (this.currentCaseNum+1)<this.currentTest.cases.length) {
this.currentCaseNum++;
this.currentCase = this.currentTest.cases[this.currentCaseNum];
this.currentCaseNum++; this.currentCase = this.currentTest.cases[this.currentCaseNum];
return true;
}
return false;
}
_nowTime() {
d = new Date();
return(("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2) + ":" + ("0" + d.getSeconds()).slice(-2) + "." + ("00" + d.getMilliseconds()).slice(-3))
}
}
/**
* TEST all Settings
*/
const SUNDAY =
new BangleTestRunner("TimeCalClock", LogSeverity.INFO)
/*
.addTestSettings({
setting: "shwDate",
setting: "shwDate",
cases: [
{ value: 0, beforeTxt:"No date display?", afterTxt: "top area should be 'emtpy'" },
{ value: 1, beforeTxt:"Locale date display?", afterTxt: "date should be 06/05/1234" },
{ value: 2, beforeTxt:"Month longname?", afterTxt: "date should be June" },
{ value: 3, beforeTxt:"Monthshort yearshort #week", afterTxt: "date should be Jun.34 #23" }
],
constructorParams: [new Date(1234,5,6,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawDate"],
functionParams: [],
})
*/
/*
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: 0, beforeTxt:"Week start Sunday?" , afterTxt: "Calendar first day is Sunday" },
{ value: 1, beforeTxt:"Week start Monday?" , afterTxt: "Calendar first day is Monday"},
{ value: 2, beforeTxt:"Week start Tuesday?" , afterTxt: "Calendar first day is Tuesday"},
{ value: 3, beforeTxt:"Week start Wednesday?" , afterTxt: "Calendar first day is Wednesday"},
{ value: 4, beforeTxt:"Week start Thursday?" , afterTxt: "Calendar first day is Thursday"},
{ value: 5, beforeTxt:"Week start Friday?" , afterTxt: "Calendar first day is Friday"},
{ value: 6, beforeTxt:"Week start Saturday?" , afterTxt: "Calendar first day is Saturday"},
],
constructorParams: [new Date(1234,5,3,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: 0, beforeTxt:"Week start Sunday?" , afterTxt: "Calendar first day is Sunday" },
{ value: 1, beforeTxt:"Week start Monday?" , afterTxt: "Calendar first day is Monday"},
{ value: 2, beforeTxt:"Week start Tuesday?" , afterTxt: "Calendar first day is Tuesday"},
{ value: 3, beforeTxt:"Week start Wednesday?" , afterTxt: "Calendar first day is Wednesday"},
{ value: 4, beforeTxt:"Week start Thursday?" , afterTxt: "Calendar first day is Thursday"},
{ value: 5, beforeTxt:"Week start Friday?" , afterTxt: "Calendar first day is Friday"},
{ value: 6, beforeTxt:"Week start Saturday?" , afterTxt: "Calendar first day is Saturday"},
],
constructorParams: [new Date(1234,5,4,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: 0, beforeTxt:"Week start Sunday?" , afterTxt: "Calendar first day is Sunday" },
{ value: 1, beforeTxt:"Week start Monday?" , afterTxt: "Calendar first day is Monday"},
{ value: 2, beforeTxt:"Week start Tuesday?" , afterTxt: "Calendar first day is Tuesday"},
{ value: 3, beforeTxt:"Week start Wednesday?" , afterTxt: "Calendar first day is Wednesday"},
{ value: 4, beforeTxt:"Week start Thursday?" , afterTxt: "Calendar first day is Thursday"},
{ value: 5, beforeTxt:"Week start Friday?" , afterTxt: "Calendar first day is Friday"},
{ value: 6, beforeTxt:"Week start Saturday?" , afterTxt: "Calendar first day is Saturday"},
],
constructorParams: [new Date(1234,5,5,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: 0, beforeTxt:"Week start Sunday?" , afterTxt: "Calendar first day is Sunday" },
{ value: 1, beforeTxt:"Week start Monday?" , afterTxt: "Calendar first day is Monday"},
{ value: 2, beforeTxt:"Week start Tuesday?" , afterTxt: "Calendar first day is Tuesday"},
{ value: 3, beforeTxt:"Week start Wednesday?" , afterTxt: "Calendar first day is Wednesday"},
{ value: 4, beforeTxt:"Week start Thursday?" , afterTxt: "Calendar first day is Thursday"},
{ value: 5, beforeTxt:"Week start Friday?" , afterTxt: "Calendar first day is Friday"},
{ value: 6, beforeTxt:"Week start Saturday?" , afterTxt: "Calendar first day is Saturday"},
],
constructorParams: [new Date(1234,5,6,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: 0, beforeTxt:"Week start Sunday?" , afterTxt: "Calendar first day is Sunday" },
{ value: 1, beforeTxt:"Week start Monday?" , afterTxt: "Calendar first day is Monday"},
{ value: 2, beforeTxt:"Week start Tuesday?" , afterTxt: "Calendar first day is Tuesday"},
{ value: 3, beforeTxt:"Week start Wednesday?" , afterTxt: "Calendar first day is Wednesday"},
{ value: 4, beforeTxt:"Week start Thursday?" , afterTxt: "Calendar first day is Thursday"},
{ value: 5, beforeTxt:"Week start Friday?" , afterTxt: "Calendar first day is Friday"},
{ value: 6, beforeTxt:"Week start Saturday?" , afterTxt: "Calendar first day is Saturday"},
],
constructorParams: [new Date(1234,5,7,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: 0, beforeTxt:"Week start Sunday?" , afterTxt: "Calendar first day is Sunday" },
{ value: 1, beforeTxt:"Week start Monday?" , afterTxt: "Calendar first day is Monday"},
{ value: 2, beforeTxt:"Week start Tuesday?" , afterTxt: "Calendar first day is Tuesday"},
{ value: 3, beforeTxt:"Week start Wednesday?" , afterTxt: "Calendar first day is Wednesday"},
{ value: 4, beforeTxt:"Week start Thursday?" , afterTxt: "Calendar first day is Thursday"},
{ value: 5, beforeTxt:"Week start Friday?" , afterTxt: "Calendar first day is Friday"},
{ value: 6, beforeTxt:"Week start Saturday?" , afterTxt: "Calendar first day is Saturday"},
],
constructorParams: [new Date(1234,5,8,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
*/
/*
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: 0, beforeTxt:"No date display?", afterTxt: "top area should be 'emtpy'" },
{ value: 1, beforeTxt:"Locale date display?", afterTxt: "date should be 06/05/1234" },
{ value: 2, beforeTxt:"Month longname?", afterTxt: "date should be Jun" },
{ value: 3, beforeTxt:"Monthshort yearshort #week", afterTxt: "date should be Jun.34 #23" }
{ value: -1, beforeTxt:"Sunday in mid?" , afterTxt: "Calendar focus today: Sunday" },
],
constructorParams: [new Date(1234,5,3,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: -1, beforeTxt:"Monday in mid?" , afterTxt: "Calendar focus today: Monday" },
],
constructorParams: [new Date(1234,5,4,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: -1, beforeTxt:"Tuesday in mid?" , afterTxt: "Calendar focus today: Tuesday" },
],
constructorParams: [new Date(1234,5,5,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: -1, beforeTxt:"Wednesday in mid?" , afterTxt: "Calendar focus today: Wednesday" },
],
constructorParams: [new Date(1234,5,6,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawDate"],
functionNames: ["drawCal"],
functionParams: [],
})
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: -1, beforeTxt:"Thursday in mid?" , afterTxt: "Calendar focus today: Thursday" },
],
constructorParams: [new Date(1234,5,7,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: -1, beforeTxt:"Friday in mid?" , afterTxt: "Calendar focus today: Friday" },
],
constructorParams: [new Date(1234,5,8,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
.addTestSettings({
setting: "wdStrt",
cases: [
{ value: -1, beforeTxt:"Saturday in mid?" , afterTxt: "Calendar focus today: Saturday" },
],
constructorParams: [new Date(1234,5,9,7,8,9),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
*/
/*
.addTestSettings({
setting: "tdyNumClr",
cases: [
{ value: 1, beforeTxt:"Today color: red?" , afterTxt: "Today is marked red" },
{ value: 2, beforeTxt:"Today color: green?" , afterTxt: "Today is marked green" },
{ value: 3, beforeTxt:"Today color: blue?" , afterTxt: "Today is marked blue" },
],
constructorParams: [new Date(),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
*/
/*
.addTestSettings({
setting: "tdyMrkr",
cases: [
{ value: 1, beforeTxt:"Today highlight cricle?" , afterTxt: "Today circled." },
{ value: 2, beforeTxt:"Today highlight rectangle?" , afterTxt: "Today rectangled." },
{ value: 3, beforeTxt:"Today highlight filled?" , afterTxt: "Today filled." },
],
constructorParams: [new Date(),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
*/
/*
.addTestSettings({
setting: "suClr",
cases: [
{ value: 1, beforeTxt:"Sundays color: red?" , afterTxt: "Sundays are red" },
{ value: 2, beforeTxt:"Sundays color: green?" , afterTxt: "Sundays are green" },
{ value: 3, beforeTxt:"Sundays color: blue?" , afterTxt: "Sundays are blue" },
],
constructorParams: [new Date(),"|TEST_SETTINGS|"],
functionNames: ["drawCal"],
functionParams: [],
})
*/
.execute();

View File

@ -12,9 +12,9 @@
tdyNumClr:3, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
tdyMrkr:0, //0:none, 1:circle, 2:rectangle, 3:filled
tdyMrkClr:2, //1:red=#E00, 2:green=#0E0, 3:blue=#00E
tdyMrkPxl:2, //px
tdyMrkPxl:3, //px
suClr:0, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
suClr:1, //0:fg, 1:red=#E00, 2:green=#0E0, 3:blue=#00E
//phColor:"#E00", //public holiday
calBrdr:false