From 055828e8a78b0ec2a5ba6032561690cbd8f7543c Mon Sep 17 00:00:00 2001 From: Yunfei Hao Date: Tue, 25 Oct 2016 14:56:45 +0800 Subject: [PATCH] Initial version of realsense node javascript API testing --- misc/nodeapi-realsense-tests/COPYING | 24 ++ misc/nodeapi-realsense-tests/README.md | 17 + .../test-accessorder-enum-existence.js | 23 + .../test-boundingbox2dinfo-api-existence.js | 36 ++ .../test-classifyresult-enum-existence.js | 27 ++ .../test-computeengine-enum-existence.js | 25 ++ .../test-detectionmode-enum-existence.js | 37 ++ .../realsense/test-eventdata-api-existence.js | 36 ++ .../test-expression-enum-existence.js | 37 ++ .../test-expressiondata-api-existence.js | 31 ++ .../test-expressioninfo-api-existence.js | 36 ++ .../test-facelandmark-api-existence.js | 36 ++ .../test-facelandmarkdata-api-existence.js | 36 ++ .../realsense/test-feature-api-existence.js | 41 ++ .../test-gesturedata-api-existence.js | 36 ++ .../test-gesturetype-enum-existence.js | 23 + .../test-heightofinterest-api-existence.js | 36 ++ .../realsense/test-instance-api-existence.js | 121 ++++++ .../test-instancestate-enum-existence.js | 29 ++ .../test-jointtype-enum-existence.js | 71 ++++ .../realsense/test-maskinfo-api-existence.js | 46 ++ ...st-objectlocalizationdata-api-existence.js | 46 ++ .../test-objectproposaldata-api-existence.js | 36 ++ ...est-objectrecognitiondata-api-existence.js | 36 ++ .../test-occupancytile-api-existence.js | 41 ++ .../test-orientation-enum-existence.js | 33 ++ .../test-orientationinfo-api-existence.js | 36 ++ .../test-persondata-api-existence.js | 56 +++ .../test-personlying-api-existence.js | 46 ++ .../test-personlyingdata-api-existence.js | 46 ++ ...t-personlyingdetectstate-enum-existence.js | 25 ++ .../test-personrecognition-api-existence.js | 71 ++++ .../test-personrecogpolicy-enum-existence.js | 23 + .../test-persontracking-api-existence.js | 36 ++ ...test-persontrackingresult-api-existence.js | 31 ++ .../realsense/test-point-api-existence.js | 36 ++ .../realsense/test-point3d-api-existence.js | 41 ++ .../test-pointcombinedinfo-api-existence.js | 46 ++ .../test-pointinginfo-api-existence.js | 56 +++ .../realsense/test-posedata-api-existence.js | 36 ++ .../test-poseeulerangles-api-existence.js | 41 ++ .../test-positionstatetype-enum-existence.js | 27 ++ .../test-recognitionmode-enum-existence.js | 27 ++ .../test-recognizerdata-api-existence.js | 41 ++ .../realsense/test-rect-api-existence.js | 46 ++ .../test-regionofinterest-api-existence.js | 46 ++ .../test-registrationpolicy-enum-existence.js | 23 + .../test-skeletonarea-enum-existence.js | 35 ++ .../test-skeletondata-api-existence.js | 31 ++ .../test-skeletonpointinfo-api-existence.js | 51 +++ .../test-slamstate-enum-existence.js | 27 ++ .../test-trackingaccuracy-enum-existence.js | 29 ++ .../test-trackingangle-enum-existence.js | 33 ++ .../test-trackingdata-api-existence.js | 66 +++ .../test-trackingevent-api-existence.js | 36 ++ .../test-trackingmode-enum-existence.js | 33 ++ .../test-trackingresult-api-existence.js | 56 +++ .../test-trackingstate-enum-existence.js | 29 ++ misc/nodeapi-realsense-tests/suite.json | 27 ++ .../testGen/generate-test-case.js | 75 ++++ .../testGen/idl/object-recognition.widl | 71 ++++ .../testGen/idl/pt.widl | 400 ++++++++++++++++++ .../testGen/idl/slam.widl | 136 ++++++ .../testGen/interface_init.js | 7 + misc/nodeapi-realsense-tests/testGen/map.js | 12 + .../testGen/package.json | 23 + misc/nodeapi-realsense-tests/testGen/pt.js | 9 + .../testGen/templates/apiExistence.dot | 50 +++ .../testGen/templates/enumExistence.dot | 42 ++ .../testGen/templates/map.def | 47 ++ .../testGen/templates/pt.js | 23 + .../testGen/templates/typeConversion.def | 22 + .../test-trackingangle-enum-existence.js | 35 ++ 73 files changed, 3237 insertions(+) create mode 100644 misc/nodeapi-realsense-tests/COPYING create mode 100644 misc/nodeapi-realsense-tests/README.md create mode 100644 misc/nodeapi-realsense-tests/realsense/test-accessorder-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-boundingbox2dinfo-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-classifyresult-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-computeengine-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-detectionmode-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-eventdata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-expression-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-expressiondata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-expressioninfo-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-facelandmark-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-facelandmarkdata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-feature-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-gesturedata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-gesturetype-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-heightofinterest-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-instance-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-instancestate-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-jointtype-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-maskinfo-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-objectlocalizationdata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-objectproposaldata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-objectrecognitiondata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-occupancytile-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-orientation-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-orientationinfo-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-persondata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-personlying-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-personlyingdata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-personlyingdetectstate-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-personrecognition-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-personrecogpolicy-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-persontracking-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-persontrackingresult-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-point-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-point3d-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-pointcombinedinfo-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-pointinginfo-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-posedata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-poseeulerangles-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-positionstatetype-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-recognitionmode-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-recognizerdata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-rect-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-regionofinterest-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-registrationpolicy-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-skeletonarea-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-skeletondata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-skeletonpointinfo-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-slamstate-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-trackingaccuracy-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-trackingangle-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-trackingdata-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-trackingevent-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-trackingmode-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-trackingresult-api-existence.js create mode 100644 misc/nodeapi-realsense-tests/realsense/test-trackingstate-enum-existence.js create mode 100644 misc/nodeapi-realsense-tests/suite.json create mode 100644 misc/nodeapi-realsense-tests/testGen/generate-test-case.js create mode 100644 misc/nodeapi-realsense-tests/testGen/idl/object-recognition.widl create mode 100644 misc/nodeapi-realsense-tests/testGen/idl/pt.widl create mode 100644 misc/nodeapi-realsense-tests/testGen/idl/slam.widl create mode 100644 misc/nodeapi-realsense-tests/testGen/interface_init.js create mode 100644 misc/nodeapi-realsense-tests/testGen/map.js create mode 100644 misc/nodeapi-realsense-tests/testGen/package.json create mode 100644 misc/nodeapi-realsense-tests/testGen/pt.js create mode 100644 misc/nodeapi-realsense-tests/testGen/templates/apiExistence.dot create mode 100644 misc/nodeapi-realsense-tests/testGen/templates/enumExistence.dot create mode 100644 misc/nodeapi-realsense-tests/testGen/templates/map.def create mode 100644 misc/nodeapi-realsense-tests/testGen/templates/pt.js create mode 100644 misc/nodeapi-realsense-tests/testGen/templates/typeConversion.def create mode 100644 misc/nodeapi-realsense-tests/testGen/test-trackingangle-enum-existence.js diff --git a/misc/nodeapi-realsense-tests/COPYING b/misc/nodeapi-realsense-tests/COPYING new file mode 100644 index 000000000..926ebc540 --- /dev/null +++ b/misc/nodeapi-realsense-tests/COPYING @@ -0,0 +1,24 @@ +Copyright (c) 2016 Intel Corporation. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of works must retain the original copyright notice, this list + of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the original copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this work without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/misc/nodeapi-realsense-tests/README.md b/misc/nodeapi-realsense-tests/README.md new file mode 100644 index 000000000..a16d1a0f7 --- /dev/null +++ b/misc/nodeapi-realsense-tests/README.md @@ -0,0 +1,17 @@ +# RealSense Node JavaScript Test Suite + +## Introduction + +This test suite is for checking compliance with RealSense node API specification: +* https://github.com/otcshare/node-realsense/tree/master/src + +## Authors + +* Hao, Yunfei +* Zhao, Ming + +## LICENSE + +Copyright (c) 2016 Intel Corporation. +Except as noted, this software is licensed under BSD-3-Clause License. +Please see the COPYING file for the BSD-3-Clause License. diff --git a/misc/nodeapi-realsense-tests/realsense/test-accessorder-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-accessorder-enum-existence.js new file mode 100644 index 000000000..aae37dcea --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-accessorder-enum-existence.js @@ -0,0 +1,23 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("access-order-by-id") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum AccessOrder', function(){ + it('checking member of AccessOrder: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-boundingbox2dinfo-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-boundingbox2dinfo-api-existence.js new file mode 100644 index 000000000..e1adc793c --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-boundingbox2dinfo-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('BoundingBox2DInfo API Test', function () { + + describe('API Existance', function() { + it('addon.BoundingBox2DInfo is exist', function() { + assert.isTrue(typeof(addon.BoundingBox2DInfo) !== 'undefined' ) + }); + + it('addon.BoundingBox2DInfo type is correct', function() { + assert.typeOf(addon.BoundingBox2DInfo,'function'); + }); + + it('addon.BoundingBox2DInfo() object has a Rect attribute .rect', function () { + var test_obj = addon[ii.newMap['BoundingBox2DInfo']]; + assert.typeOf(test_obj.rect,'Rect'); + }); + + it('addon.BoundingBox2DInfo() object has a number attribute .confidence', function () { + var test_obj = addon[ii.newMap['BoundingBox2DInfo']]; + assert.typeOf(test_obj.confidence,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-classifyresult-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-classifyresult-enum-existence.js new file mode 100644 index 000000000..0bf9e0c76 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-classifyresult-enum-existence.js @@ -0,0 +1,27 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("classified") + +enum_group.push("need-different-view-point") + +enum_group.push("not-classified") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum ClassifyResult', function(){ + it('checking member of ClassifyResult: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-computeengine-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-computeengine-enum-existence.js new file mode 100644 index 000000000..81b0eb2ed --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-computeengine-enum-existence.js @@ -0,0 +1,25 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("CPU") + +enum_group.push("GPU") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum ComputeEngine', function(){ + it('checking member of ComputeEngine: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-detectionmode-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-detectionmode-enum-existence.js new file mode 100644 index 000000000..40c475aca --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-detectionmode-enum-existence.js @@ -0,0 +1,37 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("auto") + +enum_group.push("close-range") + +enum_group.push("mid-range") + +enum_group.push("far-range") + +enum_group.push("all") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum DetectionMode', function(){ + it('checking member of DetectionMode: '+ enum_group[i], function(done) { + + var cfg = {} + cfg['detectMode']['tracking'] = enum_group[i]; + var instance = new module.Instance(cfg); + instance.getInstanceConfig().then(data => { + assert.equal(data.tracking.detectMode, enum_group[i]); + done(); + }); + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-eventdata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-eventdata-api-existence.js new file mode 100644 index 000000000..5872c1942 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-eventdata-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('EventData API Test', function () { + + describe('API Existance', function() { + it('addon.EventData is exist', function() { + assert.isTrue(typeof(addon.EventData) !== 'undefined' ) + }); + + it('addon.EventData type is correct', function() { + assert.typeOf(addon.EventData,'function'); + }); + + it('addon.EventData() object has a TrackingAccuracy attribute .accuracy', function () { + var test_obj = addon[ii.newMap['EventData']]; + assert.typeOf(test_obj.accuracy,'TrackingAccuracy'); + }); + + it('addon.EventData() object has a number attribute .cameraPose', function () { + var test_obj = addon[ii.newMap['EventData']]; + assert.typeOf(test_obj.cameraPose,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-expression-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-expression-enum-existence.js new file mode 100644 index 000000000..4190d843e --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-expression-enum-existence.js @@ -0,0 +1,37 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("neutral") + +enum_group.push("happiness") + +enum_group.push("sadness") + +enum_group.push("surprise") + +enum_group.push("fear") + +enum_group.push("anger") + +enum_group.push("disgust") + +enum_group.push("contempt") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum Expression', function(){ + it('checking member of Expression: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-expressiondata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-expressiondata-api-existence.js new file mode 100644 index 000000000..75e4b5278 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-expressiondata-api-existence.js @@ -0,0 +1,31 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('ExpressionData API Test', function () { + + describe('API Existance', function() { + it('addon.ExpressionData is exist', function() { + assert.isTrue(typeof(addon.ExpressionData) !== 'undefined' ) + }); + + it('addon.ExpressionData type is correct', function() { + assert.typeOf(addon.ExpressionData,'function'); + }); + + it('addon.ExpressionData() object has a ExpressionInfo attribute .infos', function () { + var test_obj = addon[ii.newMap['ExpressionData']]; + assert.typeOf(test_obj.infos,'ExpressionInfo'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-expressioninfo-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-expressioninfo-api-existence.js new file mode 100644 index 000000000..89503165a --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-expressioninfo-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('ExpressionInfo API Test', function () { + + describe('API Existance', function() { + it('addon.ExpressionInfo is exist', function() { + assert.isTrue(typeof(addon.ExpressionInfo) !== 'undefined' ) + }); + + it('addon.ExpressionInfo type is correct', function() { + assert.typeOf(addon.ExpressionInfo,'function'); + }); + + it('addon.ExpressionInfo() object has a Expression attribute .type', function () { + var test_obj = addon[ii.newMap['ExpressionInfo']]; + assert.typeOf(test_obj.type,'Expression'); + }); + + it('addon.ExpressionInfo() object has a number attribute .confidence', function () { + var test_obj = addon[ii.newMap['ExpressionInfo']]; + assert.typeOf(test_obj.confidence,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-facelandmark-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-facelandmark-api-existence.js new file mode 100644 index 000000000..e2824f739 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-facelandmark-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('FaceLandmark API Test', function () { + + describe('API Existance', function() { + it('addon.FaceLandmark is exist', function() { + assert.isTrue(typeof(addon.FaceLandmark) !== 'undefined' ) + }); + + it('addon.FaceLandmark type is correct', function() { + assert.typeOf(addon.FaceLandmark,'function'); + }); + + it('addon.FaceLandmark() object has a Point3D attribute .image', function () { + var test_obj = addon[ii.newMap['FaceLandmark']]; + assert.typeOf(test_obj.image,'Point3D'); + }); + + it('addon.FaceLandmark() object has a Point3D attribute .world', function () { + var test_obj = addon[ii.newMap['FaceLandmark']]; + assert.typeOf(test_obj.world,'Point3D'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-facelandmarkdata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-facelandmarkdata-api-existence.js new file mode 100644 index 000000000..e9298c7c6 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-facelandmarkdata-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('FaceLandmarkData API Test', function () { + + describe('API Existance', function() { + it('addon.FaceLandmarkData is exist', function() { + assert.isTrue(typeof(addon.FaceLandmarkData) !== 'undefined' ) + }); + + it('addon.FaceLandmarkData type is correct', function() { + assert.typeOf(addon.FaceLandmarkData,'function'); + }); + + it('addon.FaceLandmarkData() object has a FaceLandmark attribute .landmarks', function () { + var test_obj = addon[ii.newMap['FaceLandmarkData']]; + assert.typeOf(test_obj.landmarks,'FaceLandmark'); + }); + + it('addon.FaceLandmarkData() object has a number attribute .confidence', function () { + var test_obj = addon[ii.newMap['FaceLandmarkData']]; + assert.typeOf(test_obj.confidence,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-feature-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-feature-api-existence.js new file mode 100644 index 000000000..fff30f3a5 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-feature-api-existence.js @@ -0,0 +1,41 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('Feature API Test', function () { + + describe('API Existance', function() { + it('addon.Feature is exist', function() { + assert.isTrue(typeof(addon.Feature) !== 'undefined' ) + }); + + it('addon.Feature type is correct', function() { + assert.typeOf(addon.Feature,'function'); + }); + + it('addon.Feature() object has a number attribute .id', function () { + var test_obj = addon[ii.newMap['Feature']]; + assert.typeOf(test_obj.id,'number'); + }); + + it('addon.Feature() object has a Point3D attribute .worldPosition', function () { + var test_obj = addon[ii.newMap['Feature']]; + assert.typeOf(test_obj.worldPosition,'Point3D'); + }); + + it('addon.Feature() object has a Point attribute .imagePosition', function () { + var test_obj = addon[ii.newMap['Feature']]; + assert.typeOf(test_obj.imagePosition,'Point'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-gesturedata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-gesturedata-api-existence.js new file mode 100644 index 000000000..6b1a03a6e --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-gesturedata-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('GestureData API Test', function () { + + describe('API Existance', function() { + it('addon.GestureData is exist', function() { + assert.isTrue(typeof(addon.GestureData) !== 'undefined' ) + }); + + it('addon.GestureData type is correct', function() { + assert.typeOf(addon.GestureData,'function'); + }); + + it('addon.GestureData() object has a boolean attribute .isPointing', function () { + var test_obj = addon[ii.newMap['GestureData']]; + assert.typeOf(test_obj.isPointing,'boolean'); + }); + + it('addon.GestureData() object has a PointingInfo attribute .thePointingInfo', function () { + var test_obj = addon[ii.newMap['GestureData']]; + assert.typeOf(test_obj.thePointingInfo,'PointingInfo'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-gesturetype-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-gesturetype-enum-existence.js new file mode 100644 index 000000000..799125aa4 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-gesturetype-enum-existence.js @@ -0,0 +1,23 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("pointing") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum GestureType', function(){ + it('checking member of GestureType: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-heightofinterest-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-heightofinterest-api-existence.js new file mode 100644 index 000000000..49a744a63 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-heightofinterest-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('HeightOfInterest API Test', function () { + + describe('API Existance', function() { + it('addon.HeightOfInterest is exist', function() { + assert.isTrue(typeof(addon.HeightOfInterest) !== 'undefined' ) + }); + + it('addon.HeightOfInterest type is correct', function() { + assert.typeOf(addon.HeightOfInterest,'function'); + }); + + it('addon.HeightOfInterest() object has a number attribute .minHeight', function () { + var test_obj = addon[ii.newMap['HeightOfInterest']]; + assert.typeOf(test_obj.minHeight,'number'); + }); + + it('addon.HeightOfInterest() object has a number attribute .maxHeight', function () { + var test_obj = addon[ii.newMap['HeightOfInterest']]; + assert.typeOf(test_obj.maxHeight,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-instance-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-instance-api-existence.js new file mode 100644 index 000000000..ba9bdbeaf --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-instance-api-existence.js @@ -0,0 +1,121 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('Instance API Test', function () { + + describe('API Existance', function() { + it('addon.Instance is exist', function() { + assert.isTrue(typeof(addon.Instance) !== 'undefined' ) + }); + + it('addon.Instance type is correct', function() { + assert.typeOf(addon.Instance,'function'); + }); + + it('addon.Instance() object has a SlamState attribute .state', function () { + var test_obj = addon[ii.newMap['Instance']]; + assert.typeOf(test_obj.state,'SlamState'); + }); + + it('new addon.Instance() object has a method .getCameraConfig(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.getCameraConfig, 'function'); + }); + + it('new addon.Instance() object has a method .getInstanceConfig(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.getInstanceConfig, 'function'); + }); + + it('new addon.Instance() object has a method .setCameraConfig(1)', function () { + var x = new addon.Instance(); + assert.typeOf(x.setCameraConfig, 'function'); + }); + + it('new addon.Instance() object has a method .setInstanceConfig(1)', function () { + var x = new addon.Instance(); + assert.typeOf(x.setInstanceConfig, 'function'); + }); + + it('new addon.Instance() object has a method .reset(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.reset, 'function'); + }); + + it('new addon.Instance() object has a method .start(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.start, 'function'); + }); + + it('new addon.Instance() object has a method .stop(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.stop, 'function'); + }); + + it('new addon.Instance() object has a method .pause(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.pause, 'function'); + }); + + it('new addon.Instance() object has a method .resume(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.resume, 'function'); + }); + + it('new addon.Instance() object has a method .restart(1)', function () { + var x = new addon.Instance(); + assert.typeOf(x.restart, 'function'); + }); + + it('new addon.Instance() object has a method .getTrackingResult(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.getTrackingResult, 'function'); + }); + + it('new addon.Instance() object has a method .getOccupancyMap(1)', function () { + var x = new addon.Instance(); + assert.typeOf(x.getOccupancyMap, 'function'); + }); + + it('new addon.Instance() object has a method .loadOccupancyMap(1)', function () { + var x = new addon.Instance(); + assert.typeOf(x.loadOccupancyMap, 'function'); + }); + + it('new addon.Instance() object has a method .saveOccupancyMap(1)', function () { + var x = new addon.Instance(); + assert.typeOf(x.saveOccupancyMap, 'function'); + }); + + it('new addon.Instance() object has a method .saveOccupancyMapAsPpm(2)', function () { + var x = new addon.Instance(); + assert.typeOf(x.saveOccupancyMapAsPpm, 'function'); + }); + + it('new addon.Instance() object has a method .loadRelocalizationMap(1)', function () { + var x = new addon.Instance(); + assert.typeOf(x.loadRelocalizationMap, 'function'); + }); + + it('new addon.Instance() object has a method .saveRelocalizationMap(1)', function () { + var x = new addon.Instance(); + assert.typeOf(x.saveRelocalizationMap, 'function'); + }); + + it('new addon.Instance() object has a method .getRelocalizationPose(0)', function () { + var x = new addon.Instance(); + assert.typeOf(x.getRelocalizationPose, 'function'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-instancestate-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-instancestate-enum-existence.js new file mode 100644 index 000000000..d4263ccdd --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-instancestate-enum-existence.js @@ -0,0 +1,29 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("ready") + +enum_group.push("starting") + +enum_group.push("running") + +enum_group.push("stopping") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum InstanceState', function(){ + it('checking member of InstanceState: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-jointtype-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-jointtype-enum-existence.js new file mode 100644 index 000000000..320afebf2 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-jointtype-enum-existence.js @@ -0,0 +1,71 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("ankle-left") + +enum_group.push("ankle-right") + +enum_group.push("elbow-left") + +enum_group.push("elbow-right") + +enum_group.push("foot-left") + +enum_group.push("foot-right") + +enum_group.push("hand-left") + +enum_group.push("hand-right") + +enum_group.push("hand-tip-left") + +enum_group.push("hand-tip-right") + +enum_group.push("head") + +enum_group.push("hip-left") + +enum_group.push("hip-right") + +enum_group.push("knee-left") + +enum_group.push("knee-right") + +enum_group.push("neck") + +enum_group.push("shoulder-left") + +enum_group.push("shoulder-right") + +enum_group.push("spine-base") + +enum_group.push("spine-mid") + +enum_group.push("spine-shoulder") + +enum_group.push("thumb-left") + +enum_group.push("thumb-right") + +enum_group.push("wrist-left") + +enum_group.push("wrist-right") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum JointType', function(){ + it('checking member of JointType: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-maskinfo-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-maskinfo-api-existence.js new file mode 100644 index 000000000..89fe71ab9 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-maskinfo-api-existence.js @@ -0,0 +1,46 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('MaskInfo API Test', function () { + + describe('API Existance', function() { + it('addon.MaskInfo is exist', function() { + assert.isTrue(typeof(addon.MaskInfo) !== 'undefined' ) + }); + + it('addon.MaskInfo type is correct', function() { + assert.typeOf(addon.MaskInfo,'function'); + }); + + it('addon.MaskInfo() object has a number attribute .width', function () { + var test_obj = addon[ii.newMap['MaskInfo']]; + assert.typeOf(test_obj.width,'number'); + }); + + it('addon.MaskInfo() object has a number attribute .height', function () { + var test_obj = addon[ii.newMap['MaskInfo']]; + assert.typeOf(test_obj.height,'number'); + }); + + it('addon.MaskInfo() object has a number attribute .timestamp', function () { + var test_obj = addon[ii.newMap['MaskInfo']]; + assert.typeOf(test_obj.timestamp,'number'); + }); + + it('addon.MaskInfo() object has a ArrayBuffer attribute .maskData', function () { + var test_obj = addon[ii.newMap['MaskInfo']]; + assert.typeOf(test_obj.maskData,'ArrayBuffer'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-objectlocalizationdata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-objectlocalizationdata-api-existence.js new file mode 100644 index 000000000..fc9861c56 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-objectlocalizationdata-api-existence.js @@ -0,0 +1,46 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('ObjectLocalizationData API Test', function () { + + describe('API Existance', function() { + it('addon.ObjectLocalizationData is exist', function() { + assert.isTrue(typeof(addon.ObjectLocalizationData) !== 'undefined' ) + }); + + it('addon.ObjectLocalizationData type is correct', function() { + assert.typeOf(addon.ObjectLocalizationData,'function'); + }); + + it('addon.ObjectLocalizationData() object has a number attribute .label', function () { + var test_obj = addon[ii.newMap['ObjectLocalizationData']]; + assert.typeOf(test_obj.label,'number'); + }); + + it('addon.ObjectLocalizationData() object has a number attribute .probability', function () { + var test_obj = addon[ii.newMap['ObjectLocalizationData']]; + assert.typeOf(test_obj.probability,'number'); + }); + + it('addon.ObjectLocalizationData() object has a DOMRect attribute .roi', function () { + var test_obj = addon[ii.newMap['ObjectLocalizationData']]; + assert.typeOf(test_obj.roi,'DOMRect'); + }); + + it('addon.ObjectLocalizationData() object has a DOMPoint attribute .objectCenter', function () { + var test_obj = addon[ii.newMap['ObjectLocalizationData']]; + assert.typeOf(test_obj.objectCenter,'DOMPoint'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-objectproposaldata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-objectproposaldata-api-existence.js new file mode 100644 index 000000000..dbc3a349b --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-objectproposaldata-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('ObjectProposalData API Test', function () { + + describe('API Existance', function() { + it('addon.ObjectProposalData is exist', function() { + assert.isTrue(typeof(addon.ObjectProposalData) !== 'undefined' ) + }); + + it('addon.ObjectProposalData type is correct', function() { + assert.typeOf(addon.ObjectProposalData,'function'); + }); + + it('addon.ObjectProposalData() object has a number attribute .objectness', function () { + var test_obj = addon[ii.newMap['ObjectProposalData']]; + assert.typeOf(test_obj.objectness,'number'); + }); + + it('addon.ObjectProposalData() object has a DOMRect attribute .roi', function () { + var test_obj = addon[ii.newMap['ObjectProposalData']]; + assert.typeOf(test_obj.roi,'DOMRect'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-objectrecognitiondata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-objectrecognitiondata-api-existence.js new file mode 100644 index 000000000..ee5d0778a --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-objectrecognitiondata-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('ObjectRecognitionData API Test', function () { + + describe('API Existance', function() { + it('addon.ObjectRecognitionData is exist', function() { + assert.isTrue(typeof(addon.ObjectRecognitionData) !== 'undefined' ) + }); + + it('addon.ObjectRecognitionData type is correct', function() { + assert.typeOf(addon.ObjectRecognitionData,'function'); + }); + + it('addon.ObjectRecognitionData() object has a number attribute .label', function () { + var test_obj = addon[ii.newMap['ObjectRecognitionData']]; + assert.typeOf(test_obj.label,'number'); + }); + + it('addon.ObjectRecognitionData() object has a number attribute .probability', function () { + var test_obj = addon[ii.newMap['ObjectRecognitionData']]; + assert.typeOf(test_obj.probability,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-occupancytile-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-occupancytile-api-existence.js new file mode 100644 index 000000000..0d42562f4 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-occupancytile-api-existence.js @@ -0,0 +1,41 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('OccupancyTile API Test', function () { + + describe('API Existance', function() { + it('addon.OccupancyTile is exist', function() { + assert.isTrue(typeof(addon.OccupancyTile) !== 'undefined' ) + }); + + it('addon.OccupancyTile type is correct', function() { + assert.typeOf(addon.OccupancyTile,'function'); + }); + + it('addon.OccupancyTile() object has a number attribute .x', function () { + var test_obj = addon[ii.newMap['OccupancyTile']]; + assert.typeOf(test_obj.x,'number'); + }); + + it('addon.OccupancyTile() object has a number attribute .y', function () { + var test_obj = addon[ii.newMap['OccupancyTile']]; + assert.typeOf(test_obj.y,'number'); + }); + + it('addon.OccupancyTile() object has a number attribute .occupancy', function () { + var test_obj = addon[ii.newMap['OccupancyTile']]; + assert.typeOf(test_obj.occupancy,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-orientation-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-orientation-enum-existence.js new file mode 100644 index 000000000..3cda012ae --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-orientation-enum-existence.js @@ -0,0 +1,33 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("frontal") + +enum_group.push("45-degree-right") + +enum_group.push("45-degree-left") + +enum_group.push("profile-right") + +enum_group.push("profile-left") + +enum_group.push("rear") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum Orientation', function(){ + it('checking member of Orientation: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-orientationinfo-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-orientationinfo-api-existence.js new file mode 100644 index 000000000..37f2b11ba --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-orientationinfo-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('OrientationInfo API Test', function () { + + describe('API Existance', function() { + it('addon.OrientationInfo is exist', function() { + assert.isTrue(typeof(addon.OrientationInfo) !== 'undefined' ) + }); + + it('addon.OrientationInfo type is correct', function() { + assert.typeOf(addon.OrientationInfo,'function'); + }); + + it('addon.OrientationInfo() object has a Orientation attribute .orientType', function () { + var test_obj = addon[ii.newMap['OrientationInfo']]; + assert.typeOf(test_obj.orientType,'Orientation'); + }); + + it('addon.OrientationInfo() object has a number attribute .confidence', function () { + var test_obj = addon[ii.newMap['OrientationInfo']]; + assert.typeOf(test_obj.confidence,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-persondata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-persondata-api-existence.js new file mode 100644 index 000000000..b824640e2 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-persondata-api-existence.js @@ -0,0 +1,56 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PersonData API Test', function () { + + describe('API Existance', function() { + it('addon.PersonData is exist', function() { + assert.isTrue(typeof(addon.PersonData) !== 'undefined' ) + }); + + it('addon.PersonData type is correct', function() { + assert.typeOf(addon.PersonData,'function'); + }); + + it('addon.PersonData() object has a SkeletonData attribute .skeletonInfo', function () { + var test_obj = addon[ii.newMap['PersonData']]; + assert.typeOf(test_obj.skeletonInfo,'SkeletonData'); + }); + + it('addon.PersonData() object has a TrackingData attribute .trackInfo', function () { + var test_obj = addon[ii.newMap['PersonData']]; + assert.typeOf(test_obj.trackInfo,'TrackingData'); + }); + + it('addon.PersonData() object has a GestureData attribute .gestureInfo', function () { + var test_obj = addon[ii.newMap['PersonData']]; + assert.typeOf(test_obj.gestureInfo,'GestureData'); + }); + + it('addon.PersonData() object has a ExpressionData attribute .expressInfo', function () { + var test_obj = addon[ii.newMap['PersonData']]; + assert.typeOf(test_obj.expressInfo,'ExpressionData'); + }); + + it('addon.PersonData() object has a FaceLandmarkData attribute .landmarkInfo', function () { + var test_obj = addon[ii.newMap['PersonData']]; + assert.typeOf(test_obj.landmarkInfo,'FaceLandmarkData'); + }); + + it('addon.PersonData() object has a PoseData attribute .poseInfo', function () { + var test_obj = addon[ii.newMap['PersonData']]; + assert.typeOf(test_obj.poseInfo,'PoseData'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-personlying-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-personlying-api-existence.js new file mode 100644 index 000000000..8c8a098fa --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-personlying-api-existence.js @@ -0,0 +1,46 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PersonLying API Test', function () { + + describe('API Existance', function() { + it('addon.PersonLying is exist', function() { + assert.isTrue(typeof(addon.PersonLying) !== 'undefined' ) + }); + + it('addon.PersonLying type is correct', function() { + assert.typeOf(addon.PersonLying,'function'); + }); + + it('new addon.PersonLying() object has a method .setDetectState(1)', function () { + var x = new addon.PersonLying(); + assert.typeOf(x.setDetectState, 'function'); + }); + + it('new addon.PersonLying() object has a method .getDetectState(0)', function () { + var x = new addon.PersonLying(); + assert.typeOf(x.getDetectState, 'function'); + }); + + it('new addon.PersonLying() object has a method .getCandidatesCount(0)', function () { + var x = new addon.PersonLying(); + assert.typeOf(x.getCandidatesCount, 'function'); + }); + + it('new addon.PersonLying() object has a method .getCandidatesData(0)', function () { + var x = new addon.PersonLying(); + assert.typeOf(x.getCandidatesData, 'function'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-personlyingdata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-personlyingdata-api-existence.js new file mode 100644 index 000000000..4a9d221a3 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-personlyingdata-api-existence.js @@ -0,0 +1,46 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PersonLyingData API Test', function () { + + describe('API Existance', function() { + it('addon.PersonLyingData is exist', function() { + assert.isTrue(typeof(addon.PersonLyingData) !== 'undefined' ) + }); + + it('addon.PersonLyingData type is correct', function() { + assert.typeOf(addon.PersonLyingData,'function'); + }); + + it('addon.PersonLyingData() object has a PointCombinedInfo attribute .position', function () { + var test_obj = addon[ii.newMap['PersonLyingData']]; + assert.typeOf(test_obj.position,'PointCombinedInfo'); + }); + + it('addon.PersonLyingData() object has a BoundingBox2DInfo attribute .boundingBox', function () { + var test_obj = addon[ii.newMap['PersonLyingData']]; + assert.typeOf(test_obj.boundingBox,'BoundingBox2DInfo'); + }); + + it('addon.PersonLyingData() object has a ClassifyResult attribute .result', function () { + var test_obj = addon[ii.newMap['PersonLyingData']]; + assert.typeOf(test_obj.result,'ClassifyResult'); + }); + + it('addon.PersonLyingData() object has a number attribute .confidence', function () { + var test_obj = addon[ii.newMap['PersonLyingData']]; + assert.typeOf(test_obj.confidence,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-personlyingdetectstate-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-personlyingdetectstate-enum-existence.js new file mode 100644 index 000000000..bfc615106 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-personlyingdetectstate-enum-existence.js @@ -0,0 +1,25 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("searching") + +enum_group.push("classifing") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum PersonLyingDetectState', function(){ + it('checking member of PersonLyingDetectState: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-personrecognition-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-personrecognition-api-existence.js new file mode 100644 index 000000000..7c09f830e --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-personrecognition-api-existence.js @@ -0,0 +1,71 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PersonRecognition API Test', function () { + + describe('API Existance', function() { + it('addon.PersonRecognition is exist', function() { + assert.isTrue(typeof(addon.PersonRecognition) !== 'undefined' ) + }); + + it('addon.PersonRecognition type is correct', function() { + assert.typeOf(addon.PersonRecognition,'function'); + }); + + it('new addon.PersonRecognition() object has a method .getRegisteredIDs(0)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.getRegisteredIDs, 'function'); + }); + + it('new addon.PersonRecognition() object has a method .clearDatabase(0)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.clearDatabase, 'function'); + }); + + it('new addon.PersonRecognition() object has a method .recognizeAll(0)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.recognizeAll, 'function'); + }); + + it('new addon.PersonRecognition() object has a method .registerPerson(1)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.registerPerson, 'function'); + }); + + it('new addon.PersonRecognition() object has a method .unRegisterPerson(1)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.unRegisterPerson, 'function'); + }); + + it('new addon.PersonRecognition() object has a method .isRegistered(1)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.isRegistered, 'function'); + }); + + it('new addon.PersonRecognition() object has a method .reinforceRegistration(3)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.reinforceRegistration, 'function'); + }); + + it('new addon.PersonRecognition() object has a method .recognize(1)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.recognize, 'function'); + }); + + it('new addon.PersonRecognition() object has a method .querySimilarityScoreByID(2)', function () { + var x = new addon.PersonRecognition(); + assert.typeOf(x.querySimilarityScoreByID, 'function'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-personrecogpolicy-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-personrecogpolicy-enum-existence.js new file mode 100644 index 000000000..e54a5164d --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-personrecogpolicy-enum-existence.js @@ -0,0 +1,23 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("standard") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum PersonRecogPolicy', function(){ + it('checking member of PersonRecogPolicy: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-persontracking-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-persontracking-api-existence.js new file mode 100644 index 000000000..63eb293d0 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-persontracking-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PersonTracking API Test', function () { + + describe('API Existance', function() { + it('addon.PersonTracking is exist', function() { + assert.isTrue(typeof(addon.PersonTracking) !== 'undefined' ) + }); + + it('addon.PersonTracking type is correct', function() { + assert.typeOf(addon.PersonTracking,'function'); + }); + + it('new addon.PersonTracking() object has a method .startTrackingPerson(1)', function () { + var x = new addon.PersonTracking(); + assert.typeOf(x.startTrackingPerson, 'function'); + }); + + it('new addon.PersonTracking() object has a method .stopTrackingPerson(1)', function () { + var x = new addon.PersonTracking(); + assert.typeOf(x.stopTrackingPerson, 'function'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-persontrackingresult-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-persontrackingresult-api-existence.js new file mode 100644 index 000000000..edb0ef51b --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-persontrackingresult-api-existence.js @@ -0,0 +1,31 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PersonTrackingResult API Test', function () { + + describe('API Existance', function() { + it('addon.PersonTrackingResult is exist', function() { + assert.isTrue(typeof(addon.PersonTrackingResult) !== 'undefined' ) + }); + + it('addon.PersonTrackingResult type is correct', function() { + assert.typeOf(addon.PersonTrackingResult,'function'); + }); + + it('addon.PersonTrackingResult() object has a PersonData attribute .persons', function () { + var test_obj = addon[ii.newMap['PersonTrackingResult']]; + assert.typeOf(test_obj.persons,'PersonData'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-point-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-point-api-existence.js new file mode 100644 index 000000000..b8b89ae4a --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-point-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('Point API Test', function () { + + describe('API Existance', function() { + it('addon.Point is exist', function() { + assert.isTrue(typeof(addon.Point) !== 'undefined' ) + }); + + it('addon.Point type is correct', function() { + assert.typeOf(addon.Point,'function'); + }); + + it('addon.Point() object has a short attribute .x', function () { + var test_obj = addon[ii.newMap['Point']]; + assert.typeOf(test_obj.x,'short'); + }); + + it('addon.Point() object has a short attribute .y', function () { + var test_obj = addon[ii.newMap['Point']]; + assert.typeOf(test_obj.y,'short'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-point3d-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-point3d-api-existence.js new file mode 100644 index 000000000..fe12b63a7 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-point3d-api-existence.js @@ -0,0 +1,41 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('Point3D API Test', function () { + + describe('API Existance', function() { + it('addon.Point3D is exist', function() { + assert.isTrue(typeof(addon.Point3D) !== 'undefined' ) + }); + + it('addon.Point3D type is correct', function() { + assert.typeOf(addon.Point3D,'function'); + }); + + it('addon.Point3D() object has a short attribute .x', function () { + var test_obj = addon[ii.newMap['Point3D']]; + assert.typeOf(test_obj.x,'short'); + }); + + it('addon.Point3D() object has a short attribute .y', function () { + var test_obj = addon[ii.newMap['Point3D']]; + assert.typeOf(test_obj.y,'short'); + }); + + it('addon.Point3D() object has a short attribute .z', function () { + var test_obj = addon[ii.newMap['Point3D']]; + assert.typeOf(test_obj.z,'short'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-pointcombinedinfo-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-pointcombinedinfo-api-existence.js new file mode 100644 index 000000000..3f6c0862c --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-pointcombinedinfo-api-existence.js @@ -0,0 +1,46 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PointCombinedInfo API Test', function () { + + describe('API Existance', function() { + it('addon.PointCombinedInfo is exist', function() { + assert.isTrue(typeof(addon.PointCombinedInfo) !== 'undefined' ) + }); + + it('addon.PointCombinedInfo type is correct', function() { + assert.typeOf(addon.PointCombinedInfo,'function'); + }); + + it('addon.PointCombinedInfo() object has a Point3D attribute .worldCoordinate', function () { + var test_obj = addon[ii.newMap['PointCombinedInfo']]; + assert.typeOf(test_obj.worldCoordinate,'Point3D'); + }); + + it('addon.PointCombinedInfo() object has a Point attribute .imageCoordinate', function () { + var test_obj = addon[ii.newMap['PointCombinedInfo']]; + assert.typeOf(test_obj.imageCoordinate,'Point'); + }); + + it('addon.PointCombinedInfo() object has a number attribute .worldConfidence', function () { + var test_obj = addon[ii.newMap['PointCombinedInfo']]; + assert.typeOf(test_obj.worldConfidence,'number'); + }); + + it('addon.PointCombinedInfo() object has a number attribute .imageConfidence', function () { + var test_obj = addon[ii.newMap['PointCombinedInfo']]; + assert.typeOf(test_obj.imageConfidence,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-pointinginfo-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-pointinginfo-api-existence.js new file mode 100644 index 000000000..2d5dd75f1 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-pointinginfo-api-existence.js @@ -0,0 +1,56 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PointingInfo API Test', function () { + + describe('API Existance', function() { + it('addon.PointingInfo is exist', function() { + assert.isTrue(typeof(addon.PointingInfo) !== 'undefined' ) + }); + + it('addon.PointingInfo type is correct', function() { + assert.typeOf(addon.PointingInfo,'function'); + }); + + it('addon.PointingInfo() object has a Point3D attribute .worldOrigin', function () { + var test_obj = addon[ii.newMap['PointingInfo']]; + assert.typeOf(test_obj.worldOrigin,'Point3D'); + }); + + it('addon.PointingInfo() object has a Point3D attribute .worldDirection', function () { + var test_obj = addon[ii.newMap['PointingInfo']]; + assert.typeOf(test_obj.worldDirection,'Point3D'); + }); + + it('addon.PointingInfo() object has a Point attribute .imageOrigin', function () { + var test_obj = addon[ii.newMap['PointingInfo']]; + assert.typeOf(test_obj.imageOrigin,'Point'); + }); + + it('addon.PointingInfo() object has a Point attribute .imageDirection', function () { + var test_obj = addon[ii.newMap['PointingInfo']]; + assert.typeOf(test_obj.imageDirection,'Point'); + }); + + it('addon.PointingInfo() object has a number attribute .confidence', function () { + var test_obj = addon[ii.newMap['PointingInfo']]; + assert.typeOf(test_obj.confidence,'number'); + }); + + it('addon.PointingInfo() object has a number attribute .startTimeStamp', function () { + var test_obj = addon[ii.newMap['PointingInfo']]; + assert.typeOf(test_obj.startTimeStamp,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-posedata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-posedata-api-existence.js new file mode 100644 index 000000000..71b9399e1 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-posedata-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PoseData API Test', function () { + + describe('API Existance', function() { + it('addon.PoseData is exist', function() { + assert.isTrue(typeof(addon.PoseData) !== 'undefined' ) + }); + + it('addon.PoseData type is correct', function() { + assert.typeOf(addon.PoseData,'function'); + }); + + it('addon.PoseData() object has a PositionStateType attribute .position', function () { + var test_obj = addon[ii.newMap['PoseData']]; + assert.typeOf(test_obj.position,'PositionStateType'); + }); + + it('addon.PoseData() object has a number attribute .confidence', function () { + var test_obj = addon[ii.newMap['PoseData']]; + assert.typeOf(test_obj.confidence,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-poseeulerangles-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-poseeulerangles-api-existence.js new file mode 100644 index 000000000..96cf77e93 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-poseeulerangles-api-existence.js @@ -0,0 +1,41 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('PoseEulerAngles API Test', function () { + + describe('API Existance', function() { + it('addon.PoseEulerAngles is exist', function() { + assert.isTrue(typeof(addon.PoseEulerAngles) !== 'undefined' ) + }); + + it('addon.PoseEulerAngles type is correct', function() { + assert.typeOf(addon.PoseEulerAngles,'function'); + }); + + it('addon.PoseEulerAngles() object has a number attribute .yaw', function () { + var test_obj = addon[ii.newMap['PoseEulerAngles']]; + assert.typeOf(test_obj.yaw,'number'); + }); + + it('addon.PoseEulerAngles() object has a number attribute .pitch', function () { + var test_obj = addon[ii.newMap['PoseEulerAngles']]; + assert.typeOf(test_obj.pitch,'number'); + }); + + it('addon.PoseEulerAngles() object has a number attribute .roll', function () { + var test_obj = addon[ii.newMap['PoseEulerAngles']]; + assert.typeOf(test_obj.roll,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-positionstatetype-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-positionstatetype-enum-existence.js new file mode 100644 index 000000000..1a266e1f1 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-positionstatetype-enum-existence.js @@ -0,0 +1,27 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("lying-down") + +enum_group.push("sitting") + +enum_group.push("standing") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum PositionStateType', function(){ + it('checking member of PositionStateType: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-recognitionmode-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-recognitionmode-enum-existence.js new file mode 100644 index 000000000..46e50fdc7 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-recognitionmode-enum-existence.js @@ -0,0 +1,27 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("tracking") + +enum_group.push("single-recognition") + +enum_group.push("localization") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum RecognitionMode', function(){ + it('checking member of RecognitionMode: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-recognizerdata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-recognizerdata-api-existence.js new file mode 100644 index 000000000..0499d4f72 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-recognizerdata-api-existence.js @@ -0,0 +1,41 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('RecognizerData API Test', function () { + + describe('API Existance', function() { + it('addon.RecognizerData is exist', function() { + assert.isTrue(typeof(addon.RecognizerData) !== 'undefined' ) + }); + + it('addon.RecognizerData type is correct', function() { + assert.typeOf(addon.RecognizerData,'function'); + }); + + it('addon.RecognizerData() object has a number attribute .trackID', function () { + var test_obj = addon[ii.newMap['RecognizerData']]; + assert.typeOf(test_obj.trackID,'number'); + }); + + it('addon.RecognizerData() object has a number attribute .recogID', function () { + var test_obj = addon[ii.newMap['RecognizerData']]; + assert.typeOf(test_obj.recogID,'number'); + }); + + it('addon.RecognizerData() object has a number attribute .similarityScore', function () { + var test_obj = addon[ii.newMap['RecognizerData']]; + assert.typeOf(test_obj.similarityScore,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-rect-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-rect-api-existence.js new file mode 100644 index 000000000..b7f3b3ee8 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-rect-api-existence.js @@ -0,0 +1,46 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('Rect API Test', function () { + + describe('API Existance', function() { + it('addon.Rect is exist', function() { + assert.isTrue(typeof(addon.Rect) !== 'undefined' ) + }); + + it('addon.Rect type is correct', function() { + assert.typeOf(addon.Rect,'function'); + }); + + it('addon.Rect() object has a short attribute .x', function () { + var test_obj = addon[ii.newMap['Rect']]; + assert.typeOf(test_obj.x,'short'); + }); + + it('addon.Rect() object has a short attribute .y', function () { + var test_obj = addon[ii.newMap['Rect']]; + assert.typeOf(test_obj.y,'short'); + }); + + it('addon.Rect() object has a short attribute .w', function () { + var test_obj = addon[ii.newMap['Rect']]; + assert.typeOf(test_obj.w,'short'); + }); + + it('addon.Rect() object has a short attribute .h', function () { + var test_obj = addon[ii.newMap['Rect']]; + assert.typeOf(test_obj.h,'short'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-regionofinterest-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-regionofinterest-api-existence.js new file mode 100644 index 000000000..fbb99e112 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-regionofinterest-api-existence.js @@ -0,0 +1,46 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('RegionOfInterest API Test', function () { + + describe('API Existance', function() { + it('addon.RegionOfInterest is exist', function() { + assert.isTrue(typeof(addon.RegionOfInterest) !== 'undefined' ) + }); + + it('addon.RegionOfInterest type is correct', function() { + assert.typeOf(addon.RegionOfInterest,'function'); + }); + + it('addon.RegionOfInterest() object has a number attribute .minX', function () { + var test_obj = addon[ii.newMap['RegionOfInterest']]; + assert.typeOf(test_obj.minX,'number'); + }); + + it('addon.RegionOfInterest() object has a number attribute .minY', function () { + var test_obj = addon[ii.newMap['RegionOfInterest']]; + assert.typeOf(test_obj.minY,'number'); + }); + + it('addon.RegionOfInterest() object has a number attribute .maxX', function () { + var test_obj = addon[ii.newMap['RegionOfInterest']]; + assert.typeOf(test_obj.maxX,'number'); + }); + + it('addon.RegionOfInterest() object has a number attribute .maxY', function () { + var test_obj = addon[ii.newMap['RegionOfInterest']]; + assert.typeOf(test_obj.maxY,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-registrationpolicy-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-registrationpolicy-enum-existence.js new file mode 100644 index 000000000..adba20a2f --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-registrationpolicy-enum-existence.js @@ -0,0 +1,23 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("manual-add") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum RegistrationPolicy', function(){ + it('checking member of RegistrationPolicy: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-skeletonarea-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-skeletonarea-enum-existence.js new file mode 100644 index 000000000..7c7691307 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-skeletonarea-enum-existence.js @@ -0,0 +1,35 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("upper-body") + +enum_group.push("upper-body-rough") + +enum_group.push("full-body-rough") + +enum_group.push("full-body") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum SkeletonArea', function(){ + it('checking member of SkeletonArea: '+ enum_group[i], function(done) { + + var cfg = {} + cfg['trackingArea']['skeleton'] = enum_group[i]; + var instance = new module.Instance(cfg); + instance.getInstanceConfig().then(data => { + assert.equal(data.skeleton.trackingArea, enum_group[i]); + done(); + }); + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-skeletondata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-skeletondata-api-existence.js new file mode 100644 index 000000000..5d664d390 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-skeletondata-api-existence.js @@ -0,0 +1,31 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('SkeletonData API Test', function () { + + describe('API Existance', function() { + it('addon.SkeletonData is exist', function() { + assert.isTrue(typeof(addon.SkeletonData) !== 'undefined' ) + }); + + it('addon.SkeletonData type is correct', function() { + assert.typeOf(addon.SkeletonData,'function'); + }); + + it('addon.SkeletonData() object has a SkeletonPointInfo attribute .skeletonJoints', function () { + var test_obj = addon[ii.newMap['SkeletonData']]; + assert.typeOf(test_obj.skeletonJoints,'SkeletonPointInfo'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-skeletonpointinfo-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-skeletonpointinfo-api-existence.js new file mode 100644 index 000000000..acd0edbaf --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-skeletonpointinfo-api-existence.js @@ -0,0 +1,51 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('SkeletonPointInfo API Test', function () { + + describe('API Existance', function() { + it('addon.SkeletonPointInfo is exist', function() { + assert.isTrue(typeof(addon.SkeletonPointInfo) !== 'undefined' ) + }); + + it('addon.SkeletonPointInfo type is correct', function() { + assert.typeOf(addon.SkeletonPointInfo,'function'); + }); + + it('addon.SkeletonPointInfo() object has a JointType attribute .jointType', function () { + var test_obj = addon[ii.newMap['SkeletonPointInfo']]; + assert.typeOf(test_obj.jointType,'JointType'); + }); + + it('addon.SkeletonPointInfo() object has a Point3D attribute .worldCoord', function () { + var test_obj = addon[ii.newMap['SkeletonPointInfo']]; + assert.typeOf(test_obj.worldCoord,'Point3D'); + }); + + it('addon.SkeletonPointInfo() object has a Point attribute .imageCoord', function () { + var test_obj = addon[ii.newMap['SkeletonPointInfo']]; + assert.typeOf(test_obj.imageCoord,'Point'); + }); + + it('addon.SkeletonPointInfo() object has a number attribute .worldConfidence', function () { + var test_obj = addon[ii.newMap['SkeletonPointInfo']]; + assert.typeOf(test_obj.worldConfidence,'number'); + }); + + it('addon.SkeletonPointInfo() object has a number attribute .imageConfidence', function () { + var test_obj = addon[ii.newMap['SkeletonPointInfo']]; + assert.typeOf(test_obj.imageConfidence,'number'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-slamstate-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-slamstate-enum-existence.js new file mode 100644 index 000000000..7aac3ea26 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-slamstate-enum-existence.js @@ -0,0 +1,27 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("ready") + +enum_group.push("tracking") + +enum_group.push("paused") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum SlamState', function(){ + it('checking member of SlamState: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-trackingaccuracy-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-trackingaccuracy-enum-existence.js new file mode 100644 index 000000000..ddbd95d2e --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-trackingaccuracy-enum-existence.js @@ -0,0 +1,29 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("low") + +enum_group.push("med") + +enum_group.push("high") + +enum_group.push("failed") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum TrackingAccuracy', function(){ + it('checking member of TrackingAccuracy: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-trackingangle-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-trackingangle-enum-existence.js new file mode 100644 index 000000000..93182ed90 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-trackingangle-enum-existence.js @@ -0,0 +1,33 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("frontal") + +enum_group.push("profile") + +enum_group.push("all") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum TrackingAngle', function(){ + it('checking member of TrackingAngle: '+ enum_group[i], function(done) { + + var cfg = {} + cfg['trackingAngle'] = enum_group[i]; + var instance = new module.Instance(cfg); + instance.getInstanceConfig().then(data => { + assert.equal(data.trackingAngle, enum_group[i]); + done(); + }); + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-trackingdata-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-trackingdata-api-existence.js new file mode 100644 index 000000000..3abb84694 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-trackingdata-api-existence.js @@ -0,0 +1,66 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('TrackingData API Test', function () { + + describe('API Existance', function() { + it('addon.TrackingData is exist', function() { + assert.isTrue(typeof(addon.TrackingData) !== 'undefined' ) + }); + + it('addon.TrackingData type is correct', function() { + assert.typeOf(addon.TrackingData,'function'); + }); + + it('addon.TrackingData() object has a number attribute .id', function () { + var test_obj = addon[ii.newMap['TrackingData']]; + assert.typeOf(test_obj.id,'number'); + }); + + it('addon.TrackingData() object has a BoundingBox2DInfo attribute .boundingBox', function () { + var test_obj = addon[ii.newMap['TrackingData']]; + assert.typeOf(test_obj.boundingBox,'BoundingBox2DInfo'); + }); + + it('addon.TrackingData() object has a PointCombinedInfo attribute .center', function () { + var test_obj = addon[ii.newMap['TrackingData']]; + assert.typeOf(test_obj.center,'PointCombinedInfo'); + }); + + it('addon.TrackingData() object has a BoundingBox2DInfo attribute .headBoundingBox', function () { + var test_obj = addon[ii.newMap['TrackingData']]; + assert.typeOf(test_obj.headBoundingBox,'BoundingBox2DInfo'); + }); + + it('addon.TrackingData() object has a MaskInfo attribute .segmentationMask', function () { + var test_obj = addon[ii.newMap['TrackingData']]; + assert.typeOf(test_obj.segmentationMask,'MaskInfo'); + }); + + it('addon.TrackingData() object has a MaskInfo attribute .blobMask', function () { + var test_obj = addon[ii.newMap['TrackingData']]; + assert.typeOf(test_obj.blobMask,'MaskInfo'); + }); + + it('addon.TrackingData() object has a PoseEulerAngles attribute .headPose', function () { + var test_obj = addon[ii.newMap['TrackingData']]; + assert.typeOf(test_obj.headPose,'PoseEulerAngles'); + }); + + it('addon.TrackingData() object has a OrientationInfo attribute .orient', function () { + var test_obj = addon[ii.newMap['TrackingData']]; + assert.typeOf(test_obj.orient,'OrientationInfo'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-trackingevent-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-trackingevent-api-existence.js new file mode 100644 index 000000000..36d8c1a93 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-trackingevent-api-existence.js @@ -0,0 +1,36 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('TrackingEvent API Test', function () { + + describe('API Existance', function() { + it('addon.TrackingEvent is exist', function() { + assert.isTrue(typeof(addon.TrackingEvent) !== 'undefined' ) + }); + + it('addon.TrackingEvent type is correct', function() { + assert.typeOf(addon.TrackingEvent,'function'); + }); + + it('addon.TrackingEvent() object has a string attribute .eventName', function () { + var test_obj = addon[ii.newMap['TrackingEvent']]; + assert.typeOf(test_obj.eventName,'string'); + }); + + it('addon.TrackingEvent() object has a EventData attribute .data', function () { + var test_obj = addon[ii.newMap['TrackingEvent']]; + assert.typeOf(test_obj.data,'EventData'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-trackingmode-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-trackingmode-enum-existence.js new file mode 100644 index 000000000..5f6a3d4d9 --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-trackingmode-enum-existence.js @@ -0,0 +1,33 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("following") + +enum_group.push("interactive") + +enum_group.push("single-person") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum TrackingMode', function(){ + it('checking member of TrackingMode: '+ enum_group[i], function(done) { + + var cfg = {} + cfg['trackingMode']['tracking'] = enum_group[i]; + var instance = new module.Instance(cfg); + instance.getInstanceConfig().then(data => { + assert.equal(data.tracking.trackingMode, enum_group[i]); + done(); + }); + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/realsense/test-trackingresult-api-existence.js b/misc/nodeapi-realsense-tests/realsense/test-trackingresult-api-existence.js new file mode 100644 index 000000000..f2eb8b19a --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-trackingresult-api-existence.js @@ -0,0 +1,56 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +describe('TrackingResult API Test', function () { + + describe('API Existance', function() { + it('addon.TrackingResult is exist', function() { + assert.isTrue(typeof(addon.TrackingResult) !== 'undefined' ) + }); + + it('addon.TrackingResult type is correct', function() { + assert.typeOf(addon.TrackingResult,'function'); + }); + + it('addon.TrackingResult() object has a TrackingAccuracy attribute .accuracy', function () { + var test_obj = addon[ii.newMap['TrackingResult']]; + assert.typeOf(test_obj.accuracy,'TrackingAccuracy'); + }); + + it('addon.TrackingResult() object has a number attribute .cameraPose', function () { + var test_obj = addon[ii.newMap['TrackingResult']]; + assert.typeOf(test_obj.cameraPose,'number'); + }); + + it('addon.TrackingResult() object has a number attribute .featureNum', function () { + var test_obj = addon[ii.newMap['TrackingResult']]; + assert.typeOf(test_obj.featureNum,'number'); + }); + + it('new addon.TrackingResult() object has a method .getFeatures(0)', function () { + var x = new addon.TrackingResult(); + assert.typeOf(x.getFeatures, 'function'); + }); + + it('new addon.TrackingResult() object has a method .getOccupancyMapUpdate(1)', function () { + var x = new addon.TrackingResult(); + assert.typeOf(x.getOccupancyMapUpdate, 'function'); + }); + + it('new addon.TrackingResult() object has a method .getFrameData(0)', function () { + var x = new addon.TrackingResult(); + assert.typeOf(x.getFrameData, 'function'); + }); + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/realsense/test-trackingstate-enum-existence.js b/misc/nodeapi-realsense-tests/realsense/test-trackingstate-enum-existence.js new file mode 100644 index 000000000..e0ce777ae --- /dev/null +++ b/misc/nodeapi-realsense-tests/realsense/test-trackingstate-enum-existence.js @@ -0,0 +1,29 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("not-started") + +enum_group.push("tracking") + +enum_group.push("detecting") + +enum_group.push("stopped") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum TrackingState', function(){ + it('checking member of TrackingState: '+ enum_group[i], function(done) { + + TODO: + + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/suite.json b/misc/nodeapi-realsense-tests/suite.json new file mode 100644 index 000000000..67a5f12de --- /dev/null +++ b/misc/nodeapi-realsense-tests/suite.json @@ -0,0 +1,27 @@ +{ + "pkg-blacklist": [ + "pack.py", + "testcase.xsl", + "testresult.xsl", + "tests.css", + "icon.png", + "suite.json", + "inst.*" + ], + "pkg-list": { + "iot": { + "blacklist": [ + "*" + ], + "copylist": { + "inst.iot.py": "inst.py", + "tests.full.xml": "tests.full.xml", + "tests.xml": "tests.xml", + "package.json": "package.json", + "nodeAddon": "nodeAddon", + "realsense": "realsense" + } + } + }, + "pkg-name": "nodeapi-realsense-tests" +} diff --git a/misc/nodeapi-realsense-tests/testGen/generate-test-case.js b/misc/nodeapi-realsense-tests/testGen/generate-test-case.js new file mode 100644 index 000000000..e5536116a --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/generate-test-case.js @@ -0,0 +1,75 @@ +// Copyright (c) 2016 Intel Corporation. All rights reserved. +// Use of this source code is governed by a MIT-style license that can be +// found in the LICENSE file. + +"use strict"; + +const path = require('path'); +const fs = require("fs.promised"); +const mkdirp = require("mkdirp"); +const glob = require('glob'); + +const webIDL2 = require("webidl2"); +const dot = require("dot"); +dot.templateSettings.strip = false; // Do not remove spaces & linebreaks +const dots = dot.process({path: path.join(__dirname, "templates")}); + +const _writeFile = function(name, text) { + return fs.writeFile(name, text); +}; + +const _packEmptyLines = function(str) { + return str.replace(/\n{3,}/gm, '\n\n').replace(/(\r\n){3,}/gm, '\r\n\r\n'); +}; + +const _parseIDL = function(idlText) { + return webIDL2.parse(idlText); +}; + +const _readFile = function (path) { + return fs.readFile(path); +}; + +function generateTestCase() { + var array = glob.sync(path.join('idl','*')); + array.forEach(file =>{ + var ext = path.parse(file).ext; + if (ext === '.widl') { + _readFile(file) + .then(data => { + var idlTree = _parseIDL(data.toString()); + idlTree.forEach(def => { + def.file_name = path.parse(file).name; + console.log("----start-----"); + console.log(def); + console.log("----end-----"); + if (def.type === 'interface') { + const testText = _packEmptyLines(dots.apiExistence(def)); + const dirName = "realsense"; + mkdirp.sync(dirName); + const fileName = path.join('..', dirName, 'test-' + def.name.toLowerCase() + '-api-existence.js'); + console.log(fileName); + _writeFile(fileName, testText); + } + else if (def.type === 'enum') { + const testText = _packEmptyLines(dots.enumExistence(def)); + const dirName = "realsense"; + mkdirp.sync(dirName); + const fileName = path.join('..', dirName, 'test-' + def.name.toLowerCase() + '-enum-existence.js'); + console.log(fileName); + _writeFile(fileName, testText); + } + }); + }) + .catch(e => { + console.log(e); + }); + } + }) +} + +generateTestCase(); + +module.exports = { + generateTestCase: generateTestCase +}; diff --git a/misc/nodeapi-realsense-tests/testGen/idl/object-recognition.widl b/misc/nodeapi-realsense-tests/testGen/idl/object-recognition.widl new file mode 100644 index 000000000..c53a06bf7 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/idl/object-recognition.widl @@ -0,0 +1,71 @@ +enum RecognitionMode { + "tracking", + "single-recognition", + "localization" +}; + +enum ComputeEngine { + "CPU", + "GPU" +}; + +dictionary ModuleConfig { + RecognitionMode mode; + float confidenceThreshold; + ComputeEngine computeEngine; + boolean enableSegmentation; + long maxReturnObjectCount; + boolean enableObjectCenterEstimation; + DOMString activeClassifier; + DOMRect roi; + DOMRect[] trackingRoi; +}; + +// Data object used in "newrecognition" event +interface ObjectRecognitionData { + readonly attribute long label; + readonly attribute float probability; +}; + +// Data object used in "newlocalization" event +interface ObjectLocalizationData { + readonly attribute long label; + readonly attribute float probability; + readonly attribute DOMRect roi; + readonly attribute DOMPoint objectCenter; +}; + +// Data object used in "newproposal" event +interface ObjectProposalData { + readonly attribute float objectness; + readonly attribute DOMRect roi; +}; + +enum InstanceState { + "ready", + "starting", + "running", + "stopping" +}; + +[ +Constructor, +Constructor(ModuleConfig config), +Constructor(ModuleConfig moduleConfig, CameraConfig cameraConfig) +] +interface Instance { + readonly attribute InstanceState state; + + CameraConfig getCameraConfig(); + ModuleConfig getModuleConfig(); + + void setModuleConfig(ModuleConfig config); + void setCameraConfig(CameraConfig config); + + Promise start(); + Promise pause(); + Promise resume(); + Promise stop(); + Promise reset(); + Promise restart(); +}; diff --git a/misc/nodeapi-realsense-tests/testGen/idl/pt.widl b/misc/nodeapi-realsense-tests/testGen/idl/pt.widl new file mode 100644 index 000000000..e642a9083 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/idl/pt.widl @@ -0,0 +1,400 @@ +////////////// Global config related ////////////// +enum TrackingAngle { + "frontal", + "profile", + "all" +}; + +dictionary InstanceConfig { + TrackingAngle trackingAngle = "frontal"; + SkeletonConfig skeleton; + TrackingConfig tracking; + PersonLyingConfig lying; + PersonPoseConfig pose; + PersonRecogConfig recognition; + GestureRecogConfig gesture; + ExpressionRecogConfig expression; +}; + +/////////// Skeletion Joint Recognition ////////////////// +enum SkeletonArea { + "upper-body", + "upper-body-rough", + "full-body-rough", + "full-body" +}; + +dictionary SkeletonConfig { + boolean enable = false; + long maxTrackedPerson = 1; + SkeletonArea trackingArea = "upper-body"; +}; + + +/////////// Tracking ///////////////// +enum TrackingMode { + "following", + "interactive", + "single-person" +}; + +enum DetectionMode { + "auto", + "close-range", + "mid-range", + "far-range", + "all" +}; + +dictionary TrackingConfig { + boolean enable = true; + boolean enableSegmentation = false; + boolean enableHeadPose = false; + boolean enableBlob = false; + boolean enablePersonOrientation = false; + boolean enableHeadBoundingBox = true; + boolean enableFaceLandmarks = false; + boolean enableDetectionFromFar = false; + long maxTrackedPerson = 1; + TrackingMode trackingMode = "following"; + DetectionMode detectMode = "auto"; +}; + +/////////////////// Person Lying //////////////////////// +//Person lying is isolated from normal person tracking result as the usage +//is not clear and may perform state change interactive operations during tracking. +enum PersonLyingDetectState { + "searching", + "classifing", +}; + +dictionary PersonLyingConfig { + boolean enable = false; + long maxTrackedPerson = 1; +}; + +enum ClassifyResult { + "classified", + "need-different-view-point", + "not-classified" +}; + +interface PersonLyingData { + attribute PointCombinedInfo position; + attribute BoundingBox2DInfo boundingBox; + attribute ClassifyResult result; + attribute long confidence; +}; + +interface PersonLying { + Promise setDetectState(PersonLyingDetectState state); + Promise getDetectState(); + Promise getCandidatesCount(); + Promise getCandidatesData(); +}; + +////////////////// Pose ///////////////////////////////// +dictionary PersonPoseConfig { + boolean enable = false; + long maxTrackedPerson = 1; +}; + +/////////////////// Person Regocnition ////////////////// +enum PersonRecogPolicy { + "standard", + //"strict" +}; + +//Policy for how to register person to database +enum RegistrationPolicy { +// "automatic", //not support yet +// "manual-override", // not support yet + "manual-add" +}; + +dictionary PersonRecogConfig { + boolean enable = false; + PersonRecogPolicy policy = "standard"; + boolean useMultiFrame = false; //is multiple frame recognization or single frame. +}; + +interface RecognizerData { + attribute long trackID; //track id + attribute long recogID; //recognition id + attribute long similarityScore; +}; + +//interface to manipulate recognition +interface PersonRecognition { + Promise> getRegisteredIDs(); + Promise clearDatabase(); +// Promise exportDatabase(); +// Promise importDatabase(Uint8Array buf); + Promise> recognizeAll(); + + //API for specific person + Promise registerPerson(long trackID); //return recognition ID. + Promise unRegisterPerson(long recogID); + Promise isRegistered(long recogID); + Promise reinforceRegistration(long trackID, long recogID, RegistrationPolicy policy); + Promise recognize(long trackID); + //try to recognize a person indicated by trackID and if recognized, get the similarity score with the person indicated by recogID. + Promise querySimilarityScoreByID(long trackID, long recogID); +}; + +//////////////// Gesture Recognition ///////////////// + +enum GestureType { + "pointing" +}; + +dictionary GestureRecogConfig { + boolean enable = false; + long maxTrackedPerson = 1; //? there is no getMaxTrackedPerson + boolean enableAllGestures = false; + boolean disableAllGestures = false; + boolean enablePointing = true; +}; + +///////////////// Expression Recognition ///////////////// +enum Expression { + "neutral", + "happiness", + "sadness", + "surprise", + "fear", + "anger", + "disgust", + "contempt" +}; + +dictionary ExpressionRecogConfig { + boolean enable = false; + long maxTrackedPerson = 1; + boolean enableAllExpressions = false; + boolean disableAllExpressions = false; + boolean enableNeutral = true; + boolean enableHappy = true; + boolean enableSad = false; + boolean enableSurprise = false; + boolean enableFear = false; + boolean enableAnger = false; + boolean enableDisgust = false; + boolean enableContempt = false; +}; + +/////////////// The controller //////////////// + +interface PersonTracking { + Promise startTrackingPerson(long trackID); + Promise stopTrackingPerson(long trackID); +}; + +enum TrackingState { + "not-started", + "tracking", + "detecting", + "stopped" +}; + +[ +Constructor, +Constructor(InstanceConfig instanceCfg) +//Constructor(InstanceConfig instanceCfg,CameraConfig cameraCfg) +] +interface Instance { + readonly attribute TrackingState state; + + Promise getInstanceConfig(); +// Promise getCameraConfig(); + Promise setInstanceConfig(InstanceConfig instanceCfg); +// Promise setCameraConfig(CameraConfig cameraCfg); + + Promise start(); + Promise stop(); + //Promise pause(); + //Promise resume(); + Promise reset(); + + readonly attribute PersonRecognition personRecognition; + readonly attribute PersonLying personLying; + readonly attribute PersonTracking personTracking; + + //Events + //For the persontracked event, the data is PersonTrackingResult + //attribute EventHandler onpersontracked; +}; + +////////////// Result //////////////// + +enum AccessOrder { + "access-order-by-id" +}; + +interface PersonData { + readonly attribute SkeletonData? skeletonInfo; + readonly attribute TrackingData? trackInfo; + readonly attribute GestureData? gestureInfo; + readonly attribute ExpressionData? expressInfo; + readonly attribute FaceLandmarkData? landmarkInfo; + readonly attribute PoseData? poseInfo; +}; + +interface PersonTrackingResult { +// readonly attribute long frameID; + readonly attribute PersonData[] persons;//ordered by id by default +// FrameData getFrameData(); +}; + +enum JointType { + "ankle-left", + "ankle-right", + "elbow-left", + "elbow-right", + "foot-left", + "foot-right", + "hand-left", + "hand-right", + "hand-tip-left", + "hand-tip-right", + "head", + "hip-left", + "hip-right", + "knee-left", + "knee-right", + "neck", + "shoulder-left", + "shoulder-right", + "spine-base", + "spine-mid", + "spine-shoulder", + "thumb-left", + "thumb-right", + "wrist-left", + "wrist-right" +}; + +interface Point { + attribute short x; + attribute short y; +}; + +interface Point3D { + attribute short x; + attribute short y; + attribute short z; +}; + +interface SkeletonPointInfo { + readonly attribute JointType jointType; + readonly attribute Point3D worldCoord; + readonly attribute Point imageCoord; + readonly attribute long worldConfidence; + readonly attribute long imageConfidence; +}; + +interface SkeletonData { + readonly attribute SkeletonPointInfo[] skeletonJoints; +}; + +interface Rect { + readonly attribute short x; + readonly attribute short y; + readonly attribute short w; + readonly attribute short h; +}; + +interface BoundingBox2DInfo { + readonly attribute Rect rect; + readonly attribute long confidence; +}; + +interface MaskInfo { + readonly attribute long width; + readonly attribute long height; + readonly attribute long timestamp; + //todo, add mask data and rename the MaskInfo to be MaskInfo. + readonly attribute ArrayBuffer maskData; //ArrayBuffer not support attribute usage yet +}; + +interface PointCombinedInfo { + readonly attribute Point3D worldCoordinate; + readonly attribute Point imageCoordinate; + readonly attribute long worldConfidence; + readonly attribute long imageConfidence; +}; + +interface PoseEulerAngles { + readonly attribute float yaw; + readonly attribute float pitch; + readonly attribute float roll; +}; + +enum Orientation { + "frontal", + "45-degree-right", + "45-degree-left", + "profile-right", + "profile-left", + "rear" +}; + +interface OrientationInfo { + readonly attribute Orientation orientType; + readonly attribute long confidence; +}; + +interface TrackingData { + readonly attribute long id; + readonly attribute BoundingBox2DInfo boundingBox; + readonly attribute PointCombinedInfo center; + readonly attribute BoundingBox2DInfo? headBoundingBox; + readonly attribute MaskInfo? segmentationMask; + readonly attribute MaskInfo? blobMask; + readonly attribute PoseEulerAngles? headPose; + readonly attribute OrientationInfo? orient; +}; + +interface FaceLandmark { + readonly attribute Point3D image; //todo, use float Point3D + readonly attribute Point3D world; //todo, use float Point3D +}; + +interface FaceLandmarkData { + readonly attribute FaceLandmark[] landmarks; + readonly attribute long confidence; +}; + +interface PointingInfo { + readonly attribute Point3D worldOrigin; + readonly attribute Point3D worldDirection; + readonly attribute Point imageOrigin; + readonly attribute Point imageDirection; + readonly attribute long confidence; + readonly attribute long startTimeStamp; +}; + +interface GestureData { + readonly attribute boolean isPointing; + readonly attribute PointingInfo? thePointingInfo; +}; + +interface ExpressionInfo { + readonly attribute Expression type; + readonly attribute long confidence; +}; + +interface ExpressionData { + readonly attribute ExpressionInfo[] infos; +}; + +enum PositionStateType { + "lying-down", + "sitting", + "standing" +}; + +interface PoseData { + readonly attribute PositionStateType position; + readonly attribute long confidence; +}; diff --git a/misc/nodeapi-realsense-tests/testGen/idl/slam.widl b/misc/nodeapi-realsense-tests/testGen/idl/slam.widl new file mode 100644 index 000000000..8a20c7f14 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/idl/slam.widl @@ -0,0 +1,136 @@ +// #ifdef finaldoc + +/** + * This doc include all interfaces to the developers, exposed by SLAM module, + * no matter where the interface was implemented, by native addon's or JS wrapper. + * It will have some difference with the slam.widl file, that is for development. + */ +// #endif + +// include +enum TrackingAccuracy { + "low", + "med", + "high", + "failed" +}; + +interface Feature { + readonly attribute unsigned long id; + readonly attribute Point3D worldPosition; + readonly attribute Point imagePosition; +}; + +[Constructor] +interface RegionOfInterest { + attribute long minX; + attribute long minY; + attribute long maxX; + attribute long maxY; +}; + +interface OccupancyTile { + readonly attribute long x; + readonly attribute long y; + readonly attribute long occupancy; +}; + +[ +Constructor, +Constructor(float minHeight, float maxHeight) +] +interface HeightOfInterest { + attribute float minHeight; + attribute float maxHeight; +}; + +interface TrackingResult { + readonly attribute TrackingAccuracy accuracy; + readonly attribute float[] cameraPose; + + readonly attribute long featureNum; + Promise> getFeatures(); + + Promise> getOccupancyMapUpdate(optional RegionOfInterest roi); + Promise getFrameData(); +}; + +interface EventData { + readonly attribute TrackingAccuracy accuracy; + readonly attribute float[] cameraPose; +}; + +interface TrackingEvent { + readonly attribute String eventName; + readonly attribute EventData data; +}; + +//TODO: check if start/stop Occupancy/Relocalization can be called +//while pipleline is running. +dictionary InstanceConfig { + boolean enableOccupancyMapBuilding; + HeightOfInterest occupancyMapHeightOfInterest; + float occupancyMapResolution; + + boolean enableRelocalizationMapping; + boolean enableForceRelocalizationPose; +}; + +enum SlamState { + "ready", + "tracking", + "paused", +}; + +// #ifdef finaldoc +// This will be direct addon entry. +// Promise createInstance(); +// #endif +interface Instance { + readonly attribute SlamState state; + + // TODO: Documents should show out all the avalible config values. + // Or an extra interface querySupportedConfig()? + // Can be used to check actual module config. + Promise getCameraConfig(); + Promise getInstanceConfig(); + + // Configs should be set before start at the begining or after reset. + Promise setCameraConfig(CameraConfig config); + Promise setInstanceConfig(InstanceConfig config); + + // Reset will restore all the configs to default values. + Promise reset(); + + Promise start(); + Promise stop(); + Promise pause(); + Promise resume(); + + // Configurations will not be changed by restart. + Promise restart(optional sequence cameraPose); + + Promise getTrackingResult(); + Promise> getOccupancyMap(optional RegionOfInterest roi); + + //OPEN: Replace file name to file blob, for following 4 APIs. + Promise loadOccupancyMap(String mapFileName); + + //OPEN: no file I/O + Promise saveOccupancyMap(optional String mapFileName); + Promise saveOccupancyMapAsPpm(optional String mapFileName, optional bool drawCameraTrajectory); + + Promise loadRelocalizationMap(String mapFileName); + //@return the full path of the saved map file. + Promise saveRelocalizationMap(optional String mapFileName); + + //TODO: float32Array + Promise> getRelocalizationPose(); + + // #ifdef finaldoc + //Events + //TODO: support these in the future. + //attribute EventHandler ontracking; + //attribute EventHandler onerror; + // #endif +}; diff --git a/misc/nodeapi-realsense-tests/testGen/interface_init.js b/misc/nodeapi-realsense-tests/testGen/interface_init.js new file mode 100644 index 000000000..98433905c --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/interface_init.js @@ -0,0 +1,7 @@ +exports.newMap = { + 'VRPose': 'VRPose', + 'Meal': 'new addon.meal("adc", 1.0)', + 'DepthMask': 'new adfd.dadf("adddc", "1bbbb1111")', + 'MediaError': 'new ("fdas", "fdas")', + 'TextDecoder': 'new TextDecoder()' + }; diff --git a/misc/nodeapi-realsense-tests/testGen/map.js b/misc/nodeapi-realsense-tests/testGen/map.js new file mode 100644 index 000000000..ee6d96fa5 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/map.js @@ -0,0 +1,12 @@ +exports.mapping = { + TrackingAngle: { + InstanceConfig: 'trackingAngle', // Name of attribute which defined in dictory + Constructor: 'Instance', // Name of Constructor (to init an object) + GetInstance: 'getInstanceConfig' // method name for get dictory. + }, + SkeletonArea: { + InstanceConfig: 'trackingAngle', + Constructor: 'Instance', + GetInstance: 'getInstanceConfig', + } +} diff --git a/misc/nodeapi-realsense-tests/testGen/package.json b/misc/nodeapi-realsense-tests/testGen/package.json new file mode 100644 index 000000000..8511c8983 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/package.json @@ -0,0 +1,23 @@ +{ + "name": "widl-nan", + "version": "0.0.1", + "description": "Generate C++ NAN node-addon by Web IDL", + "author": "Kenny Yuan ", + "license": "SEE LICENSE IN LICENSE", + "dependencies": { + "assert": "^1.4.1", + "bindings": "^1.2.1", + "chai": "^3.5.0", + "commander": "^2.9.0", + "dot": "^1.0.3", + "fs-extra": "^0.30.0", + "fs.promised": "^3.0.0", + "glob": "^7.0.5", + "mkdirp": "^0.5.1", + "mocha": "^2.5.3", + "nan": "^2.3.5", + "npmlog": "^4.0.0", + "rimraf": "^2.5.4", + "webidl2": "^2.0.11" + } +} diff --git a/misc/nodeapi-realsense-tests/testGen/pt.js b/misc/nodeapi-realsense-tests/testGen/pt.js new file mode 100644 index 000000000..0eb378a7e --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/pt.js @@ -0,0 +1,9 @@ +var Instance = function Instance(cfg) { + this.cfg = cfg; +} + +Instance.prototype.getInstanceConfig = new Promise(function (resolve, reject) { + resolve({trackingAngle: 'frontal'}); +}); + +exports.Instance = Instance; diff --git a/misc/nodeapi-realsense-tests/testGen/templates/apiExistence.dot b/misc/nodeapi-realsense-tests/testGen/templates/apiExistence.dot new file mode 100644 index 000000000..eacf014a6 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/templates/apiExistence.dot @@ -0,0 +1,50 @@ +"use strict" + +const assert = require("chai").assert; +const path = require('path'); +var addon; + +beforeEach(() => { +}); + +afterEach(() => { +}); + +{{#def.typeConversion}} + +describe('{{=it.name}} API Test', function () { + + describe('API Existance', function() { + it('addon.{{=it.name}} is exist', function() { + assert.isTrue(typeof(addon.{{=it.name}}) !== 'undefined' ) + }); + + it('addon.{{=it.name}} type is correct', function() { + assert.typeOf(addon.{{=it.name}},'function'); + }); + + +{{~ it.members :p:i}} + +{{? p.type === 'attribute'}} + it('addon.{{=it.name}}() object has a {{=ConvertIDLType2JavaScript(p.idlType)}} attribute .{{=p.name}}', function () { + var test_obj = addon[ii.newMap['{{=it.name}}']]; + assert.typeOf(test_obj.{{=p.name}},'{{=ConvertIDLType2JavaScript(p.idlType)}}'); + }); +{{?}} + + +{{? p.type === 'operation'}} + + it('new addon.{{=it.name}}() object has a method .{{=p.name}}({{=p.arguments.length}})', function () { + var x = new addon.{{=it.name}}(); + assert.typeOf(x.{{=p.name}}, 'function'); + }); + +{{?}} + +{{~}} + + }); + +}); diff --git a/misc/nodeapi-realsense-tests/testGen/templates/enumExistence.dot b/misc/nodeapi-realsense-tests/testGen/templates/enumExistence.dot new file mode 100644 index 000000000..3a8d94988 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/templates/enumExistence.dot @@ -0,0 +1,42 @@ +"use strict" +{{#def.map}} +{{var info = getInfo(it.name);}} +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; +{{~ it.values :p:i}} +enum_group.push("{{=p}}") +{{~}} +enum_group.push('invalid'); + +function _test(i) { + describe('check enum {{=it.name}}', function(){ + it('checking member of {{=it.name}}: '+ enum_group[i], function(done) { + {{? !info}} + TODO: + {{?? info.ppConfig && info.ppConfig != ""}} + var cfg = {} + cfg['{{=info.pConfig}}']['{{=info.ppConfig}}'] = enum_group[i]; + var instance = new module.{{=info.constructor}}(cfg); + instance.{{=info.getInstance}}().then(data => { + assert.equal(data.{{=info.ppConfig}}.{{=info.pConfig}}, enum_group[i]); + done(); + }); + {{?? info.pConfig && info.pConfig != ""}} + var cfg = {} + cfg['{{=info.pConfig}}'] = enum_group[i]; + var instance = new module.{{=info.constructor}}(cfg); + instance.{{=info.getInstance}}().then(data => { + assert.equal(data.{{=info.pConfig}}, enum_group[i]); + done(); + }); + {{??}} + + {{?}} + }); + }); +} + +for (var x in enum_group) { + _test(x); +} diff --git a/misc/nodeapi-realsense-tests/testGen/templates/map.def b/misc/nodeapi-realsense-tests/testGen/templates/map.def new file mode 100644 index 000000000..11a263b23 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/templates/map.def @@ -0,0 +1,47 @@ +{{ + + var TrackingAngle = []; + TrackingAngle['pConfig'] = 'trackingAngle'; + TrackingAngle['constructor'] = 'Instance'; + TrackingAngle['getInstance'] = 'getInstanceConfig'; + + var SkeletonArea = []; + SkeletonArea['pConfig'] = 'trackingArea'; + SkeletonArea['ppConfig'] = 'skeleton'; + SkeletonArea['constructor'] = 'Instance'; + SkeletonArea['getInstance'] = 'getInstanceConfig'; + + var TrackingMode = []; + TrackingMode['pConfig'] = 'trackingMode'; + TrackingMode['ppConfig'] = 'tracking'; + TrackingMode['constructor'] = 'Instance'; + TrackingMode['getInstance'] = 'getInstanceConfig'; + + var DetectionMode = []; + DetectionMode['pConfig'] = 'detectMode'; + DetectionMode['ppConfig'] = 'tracking'; + DetectionMode['constructor'] = 'Instance'; + DetectionMode['getInstance'] = 'getInstanceConfig'; + + var PersonLyingDetectState= []; + PersonLyingDetectState['constructor'] = 'Instance'; + PersonLyingDetectState['getInstance'] = 'getInstanceConfig'; + + var getInfo = function(name){ + if (name == 'TrackingAngle') { + return TrackingAngle; + } + else if (name == 'SkeletonArea') { + return SkeletonArea; + } + else if (name == 'TrackingMode') { + return TrackingMode; + } + else if (name == 'DetectionMode') { + return DetectionMode; + } + else { + return null; + } + }; +}} diff --git a/misc/nodeapi-realsense-tests/testGen/templates/pt.js b/misc/nodeapi-realsense-tests/testGen/templates/pt.js new file mode 100644 index 000000000..42fac4449 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/templates/pt.js @@ -0,0 +1,23 @@ +// Copyright (c) 2016 Intel Corporation. All rights reserved. +// // Use of this source code is governed by a MIT-style license that can be +// // found in the LICENSE file. +//const webIDL2 = require('webidl2'); +var assert = require('assert'); + +//var idlTree = _readFile(file).then(data => {_parseIDL(data.toString())}); +//var enum_group = + +var PT = require('pt'); +var enum_group = ['frontal', 'profile', 'all',]; //from widl parser +enum_group.push('invild'); +describe('enum name', function(){ + for (var i in enum_group) { + it ('# enum group'+ enum_group[i], function(done){ + var CFG = {trackingAngle: enum_group[i]}; // + var Instance = new PT.Instance(CFG); + Instance.getInstanceConfig().then(data =>{ + assert.equal(data.trackingAngle, enum_group[i])}; + done()); + } + }) +}) diff --git a/misc/nodeapi-realsense-tests/testGen/templates/typeConversion.def b/misc/nodeapi-realsense-tests/testGen/templates/typeConversion.def new file mode 100644 index 000000000..9425157b8 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/templates/typeConversion.def @@ -0,0 +1,22 @@ +{{ +var ConvertIDLType2JavaScript = function (idlType) { + var type = idlType.idlType; + if (type === 'String' || type === 'DOMString' || type === 'ByteString' || type === 'USVString') { + type = 'string'; + } + else if (type === 'void') { + type = 'undefined'; + } + else if (type === 'boolean') { + type = 'boolean'; + } + else if (type === 'byte' || type === 'octet' || type === 'unsigned short' || type === 'long' || type === 'unsigned long' || type === 'long long' || type === 'DOMTimeStamp' || type === 'float' || type === 'double' || type === 'unrestricted float' || type === 'unrestricted double') { + type = 'number'; + } + else if (type === 'object') { + type = 'function'; + } + return type; +}; + +}} diff --git a/misc/nodeapi-realsense-tests/testGen/test-trackingangle-enum-existence.js b/misc/nodeapi-realsense-tests/testGen/test-trackingangle-enum-existence.js new file mode 100644 index 000000000..16c31c057 --- /dev/null +++ b/misc/nodeapi-realsense-tests/testGen/test-trackingangle-enum-existence.js @@ -0,0 +1,35 @@ +"use strict" + +const assert = require('assert'); +var module = require('./pt.js'); +var enum_group = []; + +enum_group.push("frontal") + +enum_group.push("profile") + +enum_group.push("all") + +enum_group.push('invalid'); + +function _test(i) { + describe('check enum TrackingAngle', function(){ + it('checking member of TrackingAngle: '+ enum_group[i], function(done) { + var cfg = {} + + cfg['trackingAngle'] = enum_group[i]; + + var instance = new module.Instance(cfg); + console.log(123); + instance.getInstanceConfig().then(data => { + console.log(data); + assert.equal(data.trackingAngle, enum_group[i]); + done(); + }); + }); + }); +} + +for (var x in enum_group) { + _test(x); +}