Microsoft.Protocols.TestSuites.Rdpegfx.RdpegfxTestUtility.ConvertToRect C# (CSharp) Method

ConvertToRect() public static method

Convert a position and width/height into Rectangle structure
public static ConvertToRect ( RDPGFX_POINT16 pos, ushort width, ushort height ) : RDPGFX_RECT16
pos Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpegfx.RDPGFX_POINT16 Left-top position of a rectangle
width ushort Width of a rectangle
height ushort Height of a rectangle
return Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpegfx.RDPGFX_RECT16
        public static RDPGFX_RECT16 ConvertToRect(RDPGFX_POINT16 pos, ushort width, ushort height)
        {
            return new RDPGFX_RECT16(pos.x, pos.y, (ushort)(pos.x + width), (ushort)(pos.y + height));
        }

Usage Example

        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);
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.Rdpegfx.RdpegfxTestUtility::ConvertToRect