DIR : /home/kozerus/public_html/pn/uize/site-source/js/Uize/Test/ParserTest.js
/home/kozerus/public_html/pn/uize/site-source/js/Uize/Test
/*______________
| ______ | U I Z E J A V A S C R I P T F R A M E W O R K
| / / | ---------------------------------------------------
| / O / | MODULE : Uize.Test.ParserTest Class
| / / / |
| / / / /| | ONLINE : http://www.uize.com
| /____/ /__/_| | COPYRIGHT : (c)2014-2016 UIZE
| /___ | LICENSE : Available under MIT License or GNU General Public License
|_______________| http://www.uize.com/license.html
*/
/* Module Meta Data
type: Test
importance: 1
codeCompleteness: 100
docCompleteness: 5
*/
/*?
Introduction
The =Uize.Test.ParserTest= module defines a base class for parser test classes.
*DEVELOPERS:* `Chris van Rensburg`
*/
Uize.module ({
name:'Uize.Test.ParserTest',
superclass:'Uize.Test',
builder:function (_superclass) {
'use strict';
var
/*** Variables for Performance Optimization ***/
_isPlainObject = Uize.isPlainObject
;
/*** Utility Functions ***/
function _mergeSourceIntoTarget (_target,_source) {
var
_targetPropertyValue,
_sourcePropertyValue
;
for (var _property in _source)
(
_isPlainObject (_sourcePropertyValue = _source [_property]) &&
(_targetPropertyValue = _target [_property]) &&
typeof _targetPropertyValue == 'object'
)
? _mergeSourceIntoTarget (_targetPropertyValue,_sourcePropertyValue)
: (_target [_property] = _sourcePropertyValue)
;
}
return _superclass.subclass ({
staticMethods:{
parserTest:function (_title,_arguments,_expectedInstanceState) {
return {
title:_title,
test:function () {
var
m = this,
_parser = new (Uize.getModuleByName (m.Class.parserClass)),
_result = true
;
function _expectObjectProperties (_expectedProperties,_actualProperties) {
for (var _property in _expectedProperties) {
var
_expectedProperty = _expectedProperties [_property],
_actualProperty = _actualProperties [_property]
;
if (Uize.isPlainObject (_expectedProperty)) {
_expectObjectProperties (_expectedProperty,_actualProperty);
} else {
_result = m.expect (_expectedProperty,_actualProperty);
}
if (!_result) break;
}
}
_parser.parse.apply (_parser,_arguments);
_expectObjectProperties (_expectedInstanceState,_parser);
return _result;
}
};
},
serializerTest:function (_title,_instanceStateOrSourceText,_expected) {
return {
title:_title,
test:function () {
var _parser = new (Uize.getModuleByName (this.Class.parserClass));
typeof _instanceStateOrSourceText == 'string'
? _parser.parse (_instanceStateOrSourceText)
: _mergeSourceIntoTarget (_parser,_instanceStateOrSourceText)
;
return this.expect (_expected,_parser.serialize ());
}
};
}
},
staticProperties:{
parserClass:null // this should be overridden by subclasses
}
});
}
});
//
koh5_pano
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer