This repository was archived by the owner on Aug 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
[gfx] If set ‘x’ or ‘y’ coordinate outside of the screen, will be doodled. #1649
Copy link
Copy link
Closed
Description
Description
If set 'x' or 'y' or both coordinate outside of the screen, will be doodled.
Test Code
Simple test1 for function drawVLine():
var LCD = require("ST7735.js");
var gfxLib = require("gfx");
var GFX = gfxLib.init(LCD.width, LCD.height, LCD.initScreen, LCD.drawCB, LCD);
var WHITE = [0xFF, 0xFF];
var valueArray = [
[30, -100, 200, 1],
[50, 100, 200, 1],
[70, -100, 300, 1],
[-50, -50, 300, 1],
[160, -50, 300, 1]
];
for (var k = 0; k < valueArray.length; k++) {
GFX.drawVLine(valueArray[k][0], valueArray[k][1], valueArray[k][2], WHITE, valueArray[k][3]);
console.log("\ndrawVLine(x, y, height, color, size): doodle and no error");
console.log("expected result: draw vertical line outside of the screen");
}
Simple test2 for function drawHLine():
var LCD = require("ST7735.js");
var gfxLib = require("gfx");
var GFX = gfxLib.init(LCD.width, LCD.height, LCD.initScreen, LCD.drawCB, LCD);
var WHITE = [0xFF, 0xFF];
var valueArray = [
[-100, 30, 200, 1],
[50, 100, 200, 1],
[-100, 70, 300, 1],
[-50, -50, 300, 1],
[-50, 200, 300, 1]
];
for (var k = 0; k < valueArray.length; k++) {
GFX.drawHLine(valueArray[k][0], valueArray[k][1], valueArray[k][2], WHITE, valueArray[k][3]);
console.log("\ndrawHLine(x, y, width, color, size): doodle and no error");
console.log("expected result: draw horizontal line outside of the screen");
}
Simple test3 for function drawLine():
var LCD = require("ST7735.js");
var gfxLib = require("gfx");
var GFX = gfxLib.init(LCD.width, LCD.height, LCD.initScreen, LCD.drawCB, LCD);
var WHITE = [0xFF, 0xFF];
var valueArray = [
[-50, -50, 50, 50],
[60, 60, 200, 200],
[-100, -70, 300, 300],
[-100, 10, 10, 100],
[50, 300, 300, 100]
];
for (var k = 0; k < valueArray.length; k++) {
GFX.drawLine(valueArray[k][0], valueArray[k][1], valueArray[k][2], valueArray[k][3], WHITE);
console.log("\ndrawLine(x0, y0, x1, y1, color): doodle and no error");
console.log("expected result: draw oblique line outside of the screen");
}
Simple test4 for function drawRect():
var LCD = require("ST7735.js");
var gfxLib = require("gfx");
var GFX = gfxLib.init(LCD.width, LCD.height, LCD.initScreen, LCD.drawCB, LCD);
var WHITE = [0xFF, 0xFF];
var valueArray = [
[50, -50, 50, 100],
[50, 210, 50, 100],
[-50, 50, 100, 50],
[178, 50, 100, 50],
[40, -60, 70, 280],
[-60, 40, 70, 248],
[-10, -10, 148, 180]
];
for (var k = 0; k < valueArray.length; k++) {
GFX.drawRect(valueArray[k][0], valueArray[k][1], valueArray[k][2], valueArray[k][3], WHITE);
console.log("\ndrawRect(x, y, width, height, color): doodle and no error");
console.log("expected result: draw hollow rectangle outside of the screen");
}
Steps to Reproduction
Actual Result
Doodle.
Expected Result
Don't draw them or throw out error.
Test Builds
| Branch | Commit Id | Target Device | Test Date | Result |
|---|---|---|---|---|
| master | 687af46 | Arduino 101 | Nov 9, 2017 | Fail |