Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,55 @@
'use strict';
/* global Process */
requireApp('system/lockscreen/js/stream/process.js');
suite('Process > ', function() {
test(`Would execute steps until it get shifted`, function(done) {
var process = new Process();
process
.start()
.next(() => {
return Promise.resolve().then(() => {
process.stop().next(done)
.rescue((e) => {
done(e || 'fail');
});
});
})
.next(() => {
done('fail');
});
});
test(`It's fine to handle multiple tasks`, function(done) {
var number = 0;
var process = new Process();
var task1 = (new Process())
.start()
.next(() => {
number += 1;
return Promise.resolve();
});
var task2 = (new Process())
.start()
.next(() => {
number += 1;
// This line would stuck the test, since it
// would never been resolved (as we expect
// what the 'all' method should do).
//return new Promise(() => {});
return Promise.resolve();
});
process
.start()
.wait(() => task2, () => task1)
.next(() => {
assert.equal(number, 2,
`the tasks had not been executed correctly`);
})
.next(done)
.rescue(done);
});
});

View file

@ -0,0 +1,77 @@
/* global Process, Stream */
'use strict';
/**
* Since Stream is just wrapping Process, so we could test both of them
* at the same time.
**/
requireApp('system/lockscreen/js/stream/process.js');
requireApp('system/lockscreen/js/stream/stream.js');
suite('Stream > ', function() {
test(`stream would only handle events after it's ready,
and after the process get stopped, it would stop to handle events`,
function(done) {
var stubHandler = this.sinon.stub();
var stream = new Stream({
events: ['foo'],
interrupts: ['bar'],
// A fake source is enough for testing.
sources: [{
start: () => {},
stop: () => {}
}]
});
stream
.start(stubHandler)
.ready()
.onchange(new CustomEvent('foo'))
.onchange(new CustomEvent('foo'))
.next(() => {
return stream.stop()
.onchange(new CustomEvent('foo'))
.next(() => {
assert.isFalse(stubHandler.calledOnce);
assert.isTrue(stubHandler.calledTwice);
assert.isFalse(stubHandler.calledThrice);
})
.next(done)
.rescue(done);
});
});
test(`if it's interrupt, the handler would not be queued`,
function(done) {
var stubHandler = this.sinon.spy((evt) => {
// The first 'foo' would be handled only after the stack
// is empty, so the actual handling order is 'bar->bar->foo',
// and then the queue get stuck since we don't resolve it,
// which is also the moment we do assertion.
if ('foo' === evt.type) {
assert.isTrue(stubHandler.calledThrice);
done();
}
var { promise } = Process.defer();
return promise;
// Don't resolve.
// So the next handler would not be executed,
// unless the event is an interrupt.
});
var stream = new Stream({
events: ['foo'],
interrupts: ['bar'],
sources: [{
start: () => {},
stop: () => {}
}]
});
stream
.start(stubHandler)
.ready()
.onchange(new CustomEvent('foo')) // execute
.onchange(new CustomEvent('foo')) // no execute
.onchange(new CustomEvent('bar')) // execute
.onchange(new CustomEvent('bar')); // execute
});
});