135 {
138
139 id<MTLTexture> t1, t2, t3;
140
143 t1 = drawable.texture;
144 [drawable present];
146 XCTAssertTrue(IOSurfaceIsInUse(t1.iosurface));
147
150 t2 = drawable.texture;
151 [drawable present];
153
156 t3 = drawable.texture;
157 [drawable present];
159
160
161 IOSurfaceIncrementUseCount(t3.iosurface);
162
163
164
165
167 XCTAssertEqual(drawable.texture, t1);
168 XCTAssertFalse(IOSurfaceIsInUse(drawable.texture.iosurface));
169 [drawable present];
170
172 XCTAssertEqual(drawable.texture, t2);
173 [drawable present];
175
176
178 XCTAssertEqual(drawable.texture, t1);
179
180 IOSurfaceDecrementUseCount(t3.iosurface);
181
182 [self removeMetalLayer:layer];
183}