The loader keeps no migrations any more: an asset of the old type autotile (before #131) is an unknown type and dropped, and a tilemap layer with the cell map of the first version (before #134) loads empty; every project is saved in the current format, and the two tests now pin that the old shapes are not read (#137)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bffa508ee7
commit
c91c18f495
4 files changed
+13
-47
No files matched your search
+4
-16
@@ -417,29 +417,17 @@ describe('tile in the document', () => {
|
||||
expect(tilePlayback(read)).toBe('loop');
|
||||
});
|
||||
|
||||
/**
|
||||
* #131 renamed the asset and made a plain tile the default. A project saved before that holds
|
||||
* `autotile` assets, and one of them without a stored kind meant a floor block: it has to open as
|
||||
* the same floor, not turn into a plain tile.
|
||||
*/
|
||||
it('reads an autotile of an older project as the tile it was', () => {
|
||||
// No migration any more (#137): `autotile`, the name before #131, is an unknown type like any other.
|
||||
it('drops an asset of the old type autotile', () => {
|
||||
const raw = {
|
||||
id: 'p',
|
||||
assets: [
|
||||
{ id: 's', type: 'scene', name: 'Main', props: {}, objects: [] },
|
||||
{ id: 'a', type: 'autotile', name: 'Old grass', props: {}, pictures: ['x'] },
|
||||
{ id: 'b', type: 'autotile', name: 'Old wall', props: { kind: 'wall', fps: 2 }, pictures: [] },
|
||||
{ id: 'a', type: 'autotile', name: 'Old grass', props: { kind: 'floor' }, pictures: ['x'] },
|
||||
{ id: 'c', type: 'tile', name: 'New', props: {}, pictures: [] },
|
||||
],
|
||||
};
|
||||
const project = deserializeProject(raw);
|
||||
const byId = (id: string) => project.assets.find((a): a is TileAsset => a.id === id && a.type === 'tile');
|
||||
expect(byId('a')?.pictures).toEqual(['x']);
|
||||
expect(tileKind(byId('a')!)).toBe('floor');
|
||||
expect(tileKind(byId('b')!)).toBe('wall');
|
||||
expect(byId('b')?.props.fps).toBe(2);
|
||||
expect(tileKind(byId('c')!)).toBe('none');
|
||||
expect(project.assets.some((a) => (a.type as string) === 'autotile')).toBe(false);
|
||||
expect(deserializeProject(raw).assets.map((a) => a.id)).toEqual(['s', 'c']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user