Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jabbany committed Oct 19, 2016
1 parent 903d4a9 commit ecd3875
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
24 changes: 18 additions & 6 deletions dist/CommentCoreLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -1660,8 +1660,10 @@ var AcfunFormat = (function () {

AcfunFormat.JSONParser = function (params) {
this._logBadComments = true;
this._logNotImplemented = false;
if (typeof params === 'object') {
this._logBadComments = params.logBadComments === false ? false : true;
this._logNotImplemented = params.logNotImplemented === true ? true : false;
}
};

Expand Down Expand Up @@ -1719,7 +1721,9 @@ var AcfunFormat = (function () {
case 6: data.align = 2; break;
case 8: data.align = 3; break;
default:
console.log('Cannot handle aligning to center! AlignMode=' + x.c);
if (this._logNotImplemented) {
console.log('Cannot handle aligning to center! AlignMode=' + x.c);
}
}
}
// Use default axis
Expand All @@ -1745,15 +1749,21 @@ var AcfunFormat = (function () {
var motion = {};
if (x.z[m].hasOwnProperty('rx') && typeof x.z[m].rx === 'number') {
// TODO: Support this
console.log('Encountered animated x-axis rotation. Ignoring.');
if (this._logNotImplemented) {
console.log('Encountered animated x-axis rotation. Ignoring.');
}
}
if (x.z[m].hasOwnProperty('e') && typeof x.z[m].e === 'number') {
// TODO: Support this
console.log('Encountered animated y-axis rotation. Ignoring.');
if (this._logNotImplemented) {
console.log('Encountered animated y-axis rotation. Ignoring.');
}
}
if (x.z[m].hasOwnProperty('d') && typeof x.z[m].d === 'number') {
// TODO: Support this
console.log('Encountered animated z-axis rotation. Ignoring.');
if (this._logNotImplemented) {
console.log('Encountered animated z-axis rotation. Ignoring.');
}
}
if (x.z[m].hasOwnProperty('x') && typeof x.z[m].x === 'number') {
motion.x = {
Expand Down Expand Up @@ -1806,8 +1816,10 @@ var AcfunFormat = (function () {
if (x.w.hasOwnProperty('l') && Array.isArray(x.w.l)) {
if (x.w.l.length > 0) {
// Filters
console.log('[Dbg] Filters not supported! ' +
JSON.stringify(x.w.l));
if (this._logNotImplemented) {
console.log('[Dbg] Filters not supported! ' +
JSON.stringify(x.w.l));
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/CommentCoreLibrary.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/CommentCoreLibrary_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe 'CommentManager', ->
# TODO: Construct a json that cover all types of comments
# and use it for smoking test
manager.load comments
expect(manager.timeline.length).toBe 1962
expect(manager.timeline.length).toBe 2146

describe '.send', ->
it 'sends to runline' , ->
Expand Down
1 change: 1 addition & 0 deletions spec/CommentProvider_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe 'CommentProvider', ->
# Don't actually call f
window.Promise.prototype.then = (f) -> this
window.Promise.prototype.catch = (f) -> this
window.Promise.resolve = (f) -> new Promise()

it 'has constants', ->
expect(CommentProvider.SOURCE_XML).toBe 'XML'
Expand Down
24 changes: 18 additions & 6 deletions src/parsers/AcfunFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ var AcfunFormat = (function () {

AcfunFormat.JSONParser = function (params) {
this._logBadComments = true;
this._logNotImplemented = false;
if (typeof params === 'object') {
this._logBadComments = params.logBadComments === false ? false : true;
this._logNotImplemented = params.logNotImplemented === true ? true : false;
}
};

Expand Down Expand Up @@ -67,7 +69,9 @@ var AcfunFormat = (function () {
case 6: data.align = 2; break;
case 8: data.align = 3; break;
default:
console.log('Cannot handle aligning to center! AlignMode=' + x.c);
if (this._logNotImplemented) {
console.log('Cannot handle aligning to center! AlignMode=' + x.c);
}
}
}
// Use default axis
Expand All @@ -93,15 +97,21 @@ var AcfunFormat = (function () {
var motion = {};
if (x.z[m].hasOwnProperty('rx') && typeof x.z[m].rx === 'number') {
// TODO: Support this
console.log('Encountered animated x-axis rotation. Ignoring.');
if (this._logNotImplemented) {
console.log('Encountered animated x-axis rotation. Ignoring.');
}
}
if (x.z[m].hasOwnProperty('e') && typeof x.z[m].e === 'number') {
// TODO: Support this
console.log('Encountered animated y-axis rotation. Ignoring.');
if (this._logNotImplemented) {
console.log('Encountered animated y-axis rotation. Ignoring.');
}
}
if (x.z[m].hasOwnProperty('d') && typeof x.z[m].d === 'number') {
// TODO: Support this
console.log('Encountered animated z-axis rotation. Ignoring.');
if (this._logNotImplemented) {
console.log('Encountered animated z-axis rotation. Ignoring.');
}
}
if (x.z[m].hasOwnProperty('x') && typeof x.z[m].x === 'number') {
motion.x = {
Expand Down Expand Up @@ -154,8 +164,10 @@ var AcfunFormat = (function () {
if (x.w.hasOwnProperty('l') && Array.isArray(x.w.l)) {
if (x.w.l.length > 0) {
// Filters
console.log('[Dbg] Filters not supported! ' +
JSON.stringify(x.w.l));
if (this._logNotImplemented) {
console.log('[Dbg] Filters not supported! ' +
JSON.stringify(x.w.l));
}
}
}
}
Expand Down

0 comments on commit ecd3875

Please sign in to comment.