public void RDPEGFX_CacheManagement_PositiveTest_SurfaceToCache_MaxCacheSize()
{
int maxCacheSize = RdpegfxTestUtility.maxCacheSize;
if (this.isSmallCache)
{
maxCacheSize = RdpegfxTestUtility.maxCacheSizeForSmallCache;
}
// Init for capability exchange
RDPEGFX_CapabilityExchange();
// Create a surface
this.TestSite.Log.Add(LogEntryKind.Comment, "Create a Surface.");
RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.largeSurfWidth, RdpegfxTestUtility.largeSurfHeight);
Surface surf = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);
this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);
// Add Image to cache, 1M for each image
this.TestSite.Log.Add(LogEntryKind.Comment, "Copy rects of surface to cache, each rect is 1M, there are {0} slot in total to reach max size.", maxCacheSize);
for (ushort slot = 1; slot <= maxCacheSize; slot++)
{
this.TestSite.Log.Add(LogEntryKind.Comment, "Copy a rect of surface to cache, slot is {0}.", slot);
uint fid = this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.largeCacheRect, RdpegfxTestUtility.cacheKey, slot, RdpegfxTestUtility.fillColorRed);
this.rdpegfxAdapter.ExpectFrameAck(fid);
}
// Delete the surface after wait 3 seconds.
this.rdpegfxAdapter.DeleteSurface(surf.Id);
this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
}