Support multiple sources for layers
This commit is contained in:
@@ -44,7 +44,6 @@ describe('ol/layer/Group', function () {
|
||||
opacity: 1,
|
||||
visible: true,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: undefined,
|
||||
zIndex: undefined,
|
||||
maxResolution: Infinity,
|
||||
@@ -161,7 +160,6 @@ describe('ol/layer/Group', function () {
|
||||
opacity: 0.5,
|
||||
visible: false,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: undefined,
|
||||
zIndex: 10,
|
||||
maxResolution: 500,
|
||||
@@ -203,7 +201,6 @@ describe('ol/layer/Group', function () {
|
||||
opacity: 0.5,
|
||||
visible: false,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: groupExtent,
|
||||
zIndex: undefined,
|
||||
maxResolution: 500,
|
||||
@@ -399,7 +396,6 @@ describe('ol/layer/Group', function () {
|
||||
opacity: 0.3,
|
||||
visible: false,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: groupExtent,
|
||||
zIndex: 10,
|
||||
maxResolution: 500,
|
||||
@@ -417,7 +413,6 @@ describe('ol/layer/Group', function () {
|
||||
opacity: 0,
|
||||
visible: false,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: undefined,
|
||||
zIndex: undefined,
|
||||
maxResolution: Infinity,
|
||||
@@ -433,7 +428,6 @@ describe('ol/layer/Group', function () {
|
||||
opacity: 1,
|
||||
visible: true,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: undefined,
|
||||
zIndex: undefined,
|
||||
maxResolution: Infinity,
|
||||
@@ -599,7 +593,6 @@ describe('ol/layer/Group', function () {
|
||||
opacity: 0.25,
|
||||
visible: false,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: undefined,
|
||||
zIndex: undefined,
|
||||
maxResolution: 150,
|
||||
|
||||
@@ -56,7 +56,6 @@ describe('ol/layer/Layer', function () {
|
||||
opacity: 1,
|
||||
visible: true,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: undefined,
|
||||
zIndex: undefined,
|
||||
maxResolution: Infinity,
|
||||
@@ -95,7 +94,6 @@ describe('ol/layer/Layer', function () {
|
||||
opacity: 0.5,
|
||||
visible: false,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: undefined,
|
||||
zIndex: 10,
|
||||
maxResolution: 500,
|
||||
@@ -430,7 +428,6 @@ describe('ol/layer/Layer', function () {
|
||||
opacity: 0.33,
|
||||
visible: false,
|
||||
managed: true,
|
||||
sourceState: 'ready',
|
||||
extent: undefined,
|
||||
zIndex: 10,
|
||||
maxResolution: 500,
|
||||
|
||||
@@ -373,4 +373,37 @@ describe('ol/layer/WebGLTile', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('handles multiple sources correctly', () => {
|
||||
const source = layer.getSource();
|
||||
expect(layer.getRenderSource()).to.be(source);
|
||||
layer.sources_ = (extent, resolution) => {
|
||||
return [
|
||||
{
|
||||
getState: () => 'ready',
|
||||
extent,
|
||||
resolution,
|
||||
id: 'source1',
|
||||
},
|
||||
{
|
||||
getState: () => 'ready',
|
||||
extent,
|
||||
resolution,
|
||||
id: 'source2',
|
||||
},
|
||||
];
|
||||
};
|
||||
const sourceIds = [];
|
||||
layer.getRenderer().prepareFrame = (frameState) => {
|
||||
const renderedSource = layer.getRenderSource();
|
||||
expect(renderedSource.extent).to.eql([0, 0, 100, 100]);
|
||||
expect(renderedSource.resolution).to.be(1);
|
||||
sourceIds.push(renderedSource.id);
|
||||
};
|
||||
layer.render({
|
||||
extent: [0, 0, 100, 100],
|
||||
viewState: {resolution: 1},
|
||||
});
|
||||
expect(sourceIds).to.eql(['source1', 'source2']);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user