Utility class used for RDPEGFX test. The fields defined here are only used internally.
Esempio n. 1
0
        public void RDPEGFX_CacheManagement_PositiveTest_EvictCache_DeleteCacheSlot()
        {
            ushort cacheSlot = 1;

            // 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.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            //Cache the surface to cacheslot
            this.TestSite.Log.Add(LogEntryKind.Comment, "Fill a rect on surface and cache this rect.");
            uint fid = this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.cacheRect, RdpegfxTestUtility.cacheKey, cacheSlot, RdpegfxTestUtility.fillColorRed);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            //  Delete the existing cacheslot
            this.TestSite.Log.Add(LogEntryKind.Comment, "Evict the existing cache slot.");
            fid = this.rdpegfxAdapter.EvictCachEntry(cacheSlot);
            this.rdpegfxAdapter.ExpectFrameAck(fid);
            this.TestSite.Assert.IsNotNull(fid, "Evit the existing cache slot should succeed.");

            //Cache the surface to the cache slot again after the cache slot is evited.
            //The operation should succeed.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Cache the rect to the cache slot with same cacheslot id again.");
            fid = this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.cacheRect, RdpegfxTestUtility.cacheKey, cacheSlot, RdpegfxTestUtility.fillColorGreen);
            this.rdpegfxAdapter.ExpectFrameAck(fid);
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect cache surface operation succeed.");
            this.TestSite.Assert.IsNotNull(fid, "Expect cache surface operation should succeed.");
        }
        public void RDPEGFX_SurfaceToScreen_Negative_CreateDuplicateSurface()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create the first surface and map the surface to output");
            // Create & output the first surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.SurfaceManagement_CreateDuplicatedSurface);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.SurfaceManagement_CreateDuplicatedSurface);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create the second surface with same surface id as the first surface and map the surface to output");
            // Create & ouput the second surface with a duplicated surface id
            RDPGFX_RECT16 surfRect2 = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth2, RdpegfxTestUtility.surfHeight2);
            Surface       surf2     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect2, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.Site.Assert.IsNotNull(surf2, "Surface {0} is created", surf2.Id);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when invalid message received.");
        }
Esempio n. 3
0
        public void RDPEGFX_SurfaceToSurface_PositiveTest_IntraSurfaceCopy()
        {
            uint fid;

            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            // Create & output source surface, then fill it with green color
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { RdpegfxTestUtility.copySrcRect };  // Relative to surface
            fid = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Fill a rectangle with red color and copy it to another position of the surface
            RDPGFX_POINT16[] destPts = { RdpegfxTestUtility.imgPos2 };
            fid = this.rdpegfxAdapter.IntraSurfaceCopy(surf, RdpegfxTestUtility.copySrcRect, destPts);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
Esempio n. 4
0
        public void RDPEGFX_CacheManagement_Negative_SurfaceToCache_InexistentSurface()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            // Create a surface & output 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);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.CacheManagement_SurfaceToCache_InexistentSurface);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.CacheManagement_SurfaceToCache_InexistentSurface);

            // Send message to trigger client to allocate cache slots with cache size exceed the max value 100MB
            this.TestSite.Log.Add(LogEntryKind.Comment, "Trigger client to use an inexistent surface as source for cache");
            try
            {
                this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.largeCacheRect, RdpegfxTestUtility.cacheKey, null, RdpegfxTestUtility.fillColorRed);

                //Expect the RDP client handle the negative request by dropping the connection as Windows does, or deny the request or ignore the request.
                RDPClientTryDropConnection("use an inexistent surface as source for cache");
            }
            catch (Exception ex)
            {
                this.TestSite.Log.Add(LogEntryKind.CheckFailed, "SUT should terminate the connection, or deny the request, or ignore the request to create duplicated surface instead of throw out an exception: {0}.", ex.Message);
            }
        }
        public void RDPEGFX_SurfaceToScreen_Negative_SolidFillToInexistentSurface()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.SurfaceManagement_SolidFill_ToInexistentSurface);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.SurfaceManagement_SolidFill_ToInexistentSurface);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill an inexistent surface with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill surface with green color
            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };              // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Solid color to fill an existent surface in frame: {0}", fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when invalid message received.");
        }
Esempio n. 6
0
        public void RDPEGFX_CacheManagement_Negative_Delete_InexistentCacheSlot()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            // 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);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.CacheManagement_Delete_InexistentCacheSlot);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.CacheManagement_Delete_InexistentCacheSlot);

            try
            {
                // Trigger the client to delete an inexistent cache slot
                this.TestSite.Log.Add(LogEntryKind.Comment, "Trigger the client to delete an inexistent cache slot.");
                this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.largeCacheRect, RdpegfxTestUtility.cacheKey, null, RdpegfxTestUtility.fillColorRed);
            }
            catch (Exception ex)
            {
                this.TestSite.Log.Add(LogEntryKind.Warning, "Exception thrown out when non-Windows RDP client received invalid delete inexistent cacheslot message: {0}.", ex.Message);
            }
        }
        public void RDPEGFX_SurfaceToScreen_PositiveTest_StartFrame_MaxFrameId()
        {
            uint fid;

            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill it with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill surface with green color
            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, (ushort)(RdpegfxTestUtility.surfWidth), RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            fid = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects, uint.MaxValue);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color, use max frameId: {0}", fid);

            // Expect the client to send a frame acknowledge pdu
            // If the server receives the message, it indicates that the client has been successfully decoded the logical frame of graphics commands
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
        public void RDPEGFX_SurfaceToScreen_PositiveTest_DeleteSurface()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Delete the surface
            this.TestSite.Log.Add(LogEntryKind.Comment, "Delete the surface {0}.", surf.Id);
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);

            // To verify the delete, map the deleted surface to output, expect RDP client drop the connection
            this.TestSite.Log.Add(LogEntryKind.Comment, "Map the surface {0} to the output.", surf.Id);
            this.rdpegfxAdapter.MapSurfaceToOutput(surf.Id, RdpegfxTestUtility.surfPos2.x, RdpegfxTestUtility.surfPos2.y);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when invalid message received.");
        }
        public void RDPEGFX_CacheManagement_PositiveTest_SurfaceToCache_MaxCacheSize()
        {
            int maxCacheSize = RdpegfxTestUtility.maxCacheSize;

            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            if (this.isSmallCache)
            {
                maxCacheSize = RdpegfxTestUtility.maxCacheSizeForSmallCache;
            }
            // 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);
        }
Esempio n. 10
0
        public void RDPEGFX_SurfaceToSurface_PositiveTest_SrcRectBorderOverlapSurface()
        {
            uint fid;

            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            // Create & output source surface, then fill it with green color
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            fid = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Create & output destination surface, then fill it with blue color
            RDPGFX_RECT16 surfRect2 = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos2, RdpegfxTestUtility.surfWidth2, RdpegfxTestUtility.surfHeight2);
            Surface       surf2     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect2, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf2, "Surface {0} is created", surf2.Id);

            RDPGFX_RECT16 fillSurfRect2 = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth2, RdpegfxTestUtility.surfHeight2);

            RDPGFX_RECT16[] fillRects2 = { fillSurfRect2 };
            fid = this.rdpegfxAdapter.SolidFillSurface(surf2, RdpegfxTestUtility.fillColorBlue, fillRects2);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Generate Source Rect to overlap its border with surface
            RDPGFX_RECT16 srcRect = new RDPGFX_RECT16();

            srcRect.left   = (ushort)(RdpegfxTestUtility.surfWidth - RdpegfxTestUtility.smallWidth);
            srcRect.top    = (ushort)(RdpegfxTestUtility.surfHeight - RdpegfxTestUtility.smallHeight);
            srcRect.right  = RdpegfxTestUtility.surfWidth;
            srcRect.bottom = RdpegfxTestUtility.surfHeight;
            RDPGFX_POINT16[] destPts = { RdpegfxTestUtility.imgPos2 };   // Relative to destination surface
            fid = this.rdpegfxAdapter.InterSurfaceCopy(surf, srcRect, RdpegfxTestUtility.fillColorRed, surf2, destPts);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Send RDPGFX_SURFACE_TO_SURFACE_PDU message in frame {0}, specific borders of source rect are overlapped with surface.", fid);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, new RDPGFX_RECT16[] { surfRect, surfRect2 });

            // Delete the surfaces
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
            this.rdpegfxAdapter.DeleteSurface(surf2.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf2.Id);
        }
        public void RDPEGFX_SurfaceToScreen_PositiveTest_SolidFill_FillRectsBorderOverlapSurface()
        {
            uint fid;

            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill it with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Generate fillrects in the corner
            List <RDPGFX_RECT16> rectList = new List <RDPGFX_RECT16>();
            // Top-right corner
            RDPGFX_RECT16 fillSurfRect = new RDPGFX_RECT16(
                (ushort)(RdpegfxTestUtility.surfWidth - RdpegfxTestUtility.smallWidth),
                0,
                RdpegfxTestUtility.surfWidth,
                RdpegfxTestUtility.smallHeight);

            rectList.Add(fillSurfRect);
            // bottom-right corner
            fillSurfRect = new RDPGFX_RECT16(
                (ushort)(RdpegfxTestUtility.surfWidth - RdpegfxTestUtility.smallWidth),
                (ushort)(RdpegfxTestUtility.surfHeight - RdpegfxTestUtility.smallHeight),
                RdpegfxTestUtility.surfWidth,
                RdpegfxTestUtility.surfHeight);
            rectList.Add(fillSurfRect);
            // bottom-left corner
            fillSurfRect = new RDPGFX_RECT16(
                0,
                (ushort)(RdpegfxTestUtility.surfHeight - RdpegfxTestUtility.smallHeight),
                RdpegfxTestUtility.smallWidth,
                RdpegfxTestUtility.surfHeight);
            rectList.Add(fillSurfRect);

            // Send solid fill request to client to fill surface with green color
            fid = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, rectList.ToArray());
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            // Expect the client to send a frame acknowledge pdu
            // If the server receives the message, it indicates that the client has been successfully decoded the logical frame of graphics commands
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
Esempio n. 12
0
        public void RDPEGFX_CacheManagement_PositiveTest_CacheToSurface_DestRectsOverlapped()
        {
            // 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.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill a rect to green color
            this.TestSite.Log.Add(LogEntryKind.Comment, "Send solid fill request to client to fill a rect to green color.");
            RDPGFX_RECT16 fillSurfRect = new RDPGFX_RECT16(0, 0, RdpegfxTestUtility.smallWidth, RdpegfxTestUtility.smallHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Send solid fill request to client to fill a rect to red color
            this.TestSite.Log.Add(LogEntryKind.Comment, "Send solid fill request to client to fill a rect to red color.");
            RDPGFX_RECT16 fillSurfRect2 = new RDPGFX_RECT16(RdpegfxTestUtility.smallWidth, RdpegfxTestUtility.smallHeight, (ushort)(RdpegfxTestUtility.smallWidth * 2), (ushort)(RdpegfxTestUtility.smallHeight * 2));

            RDPGFX_RECT16[] fillRects2 = { fillSurfRect2 };  // Relative to surface
            fid = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorRed, fillRects2);
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            RDPGFX_RECT16         srcRect       = new RDPGFX_RECT16(0, 0, (ushort)(RdpegfxTestUtility.smallWidth * 2), (ushort)(RdpegfxTestUtility.smallHeight * 2));
            List <RDPGFX_POINT16> destPointList = new List <RDPGFX_POINT16>();
            RDPGFX_POINT16        pos           = new RDPGFX_POINT16((ushort)(RdpegfxTestUtility.smallWidth * 2), (ushort)(RdpegfxTestUtility.smallHeight * 2));

            destPointList.Add(pos);
            pos = new RDPGFX_POINT16((ushort)(RdpegfxTestUtility.smallWidth * 3), (ushort)(RdpegfxTestUtility.smallHeight * 3));
            destPointList.Add(pos);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Copy a rect to cache; and copy the cached rect to surface.");
            fid = this.rdpegfxAdapter.FillSurfaceByCachedBitmap(surf, RdpegfxTestUtility.cacheRect, RdpegfxTestUtility.cacheKey, destPointList.ToArray(), null, null);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled by cached bitmap in frame: {0}.", fid);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            RDPGFX_RECT16 verifyRect = new RDPGFX_RECT16(
                (ushort)(RdpegfxTestUtility.smallWidth * 2), (ushort)(RdpegfxTestUtility.smallHeight * 2),
                (ushort)(RdpegfxTestUtility.smallWidth * 5), (ushort)(RdpegfxTestUtility.smallHeight * 5));

            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface after wait 3 seconds.
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
        public void RDPEGFX_Segmentation_Positive_UncompressedSegmentHeader()
        {
            this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ...");
            bool bProtocolSupported = this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer);

            this.TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            this.TestSite.Log.Add(LogEntryKind.Debug, "Expecting capability advertise from client.");
            RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise();

            this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received.");

            // Set the test type, based on the test type, all the messages in this test case will not use RDP 8.0 Bulk Compression techniques
            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.Segmentation_Uncompressed_WithSegmentHeader);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.Segmentation_Uncompressed_WithSegmentHeader);

            // Set first capset in capability advertise request, if no capdata in request, use default flag.
            CapsFlags capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT;

            if (capsAdv.capsSetCount > 0)
            {
                capFlag = (CapsFlags)BitConverter.ToUInt32(capsAdv.capsSets[0].capsData, 0);
            }
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending capability confirm message not using RDP 8.0 compression technology to client.");
            this.rdpegfxAdapter.SendCapabilityConfirm(capFlag);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill it with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill surface with green color
            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            // Expect the client to send a frame acknowledge pdu
            // If the server receives the message, it indicates that the client has been successfully decoded the logical frame of graphics commands
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Delete the surface
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
        }
Esempio n. 14
0
        private void RDPEGFX_CacheManagement(DynamicVC_TransportType transport, bool isSoftSync)
        {
            // Check if SUT supports Soft Sync.
            if (isSoftSync)
            {
                this.TestSite.Assert.IsTrue(isClientSupportSoftSync, "SUT should support Soft-Sync.");
            }

            // Init for capability exchange
            RDPEGFX_CapabilityExchange(transport, isSoftSync);

            // Create a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Build muliple cache to surface messages to cover the surface by cacheRect
            ushort cacheW = (ushort)(RdpegfxTestUtility.cacheRect.right - RdpegfxTestUtility.cacheRect.left);
            ushort cacheH = (ushort)(RdpegfxTestUtility.cacheRect.bottom - RdpegfxTestUtility.cacheRect.top);

            ushort currRectTop = 0;

            List <RDPGFX_POINT16> destPointList = new List <RDPGFX_POINT16>();

            while (currRectTop < surf.Height)
            {
                ushort currRectLeft = 0;
                while (currRectLeft < surf.Width)
                {
                    RDPGFX_POINT16 pos = new RDPGFX_POINT16(currRectLeft, currRectTop);
                    destPointList.Add(pos);
                    currRectLeft += cacheW;
                }
                currRectTop += cacheH;
            }

            uint fid = this.rdpegfxAdapter.FillSurfaceByCachedBitmap(surf, RdpegfxTestUtility.cacheRect, RdpegfxTestUtility.cacheKey, destPointList.ToArray(), null, RdpegfxTestUtility.fillColorRed);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled by cached bitmap in frame: {0}", fid);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface after wait 3 seconds.
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
Esempio n. 15
0
        public void RDPEGFX_CacheManagement_Negative_CacheToSurface_InexistentCacheSlot()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            // Create a surface & output 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);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.CacheManagement_CacheToSurface_InexistentCacheSlot);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.CacheManagement_CacheToSurface_InexistentCacheSlot);

            // Build mutliple cache to surface messages to cover the surface by cacheRect
            ushort cacheW = (ushort)(RdpegfxTestUtility.largeCacheRect.right - RdpegfxTestUtility.largeCacheRect.left);
            ushort cacheH = (ushort)(RdpegfxTestUtility.largeCacheRect.bottom - RdpegfxTestUtility.largeCacheRect.top);

            ushort currRectTop = 0;

            // DestPointList is a list of positions in destination surface where the bitmap cache will copy to
            List <RDPGFX_POINT16> destPointList = new List <RDPGFX_POINT16>();

            while (currRectTop < surf.Height)
            {
                ushort currRectLeft = 0;
                while (currRectLeft < surf.Width)
                {
                    RDPGFX_POINT16 pos = new RDPGFX_POINT16(currRectLeft, currRectTop);
                    destPointList.Add(pos);
                    currRectLeft += cacheW;
                }
                currRectTop += cacheH;
            }

            // Trigger the client to copy cached bitmap from an inexsitent cache slot to destination surface
            this.TestSite.Log.Add(LogEntryKind.Comment, "Trigger the client to copy cached bitmap from an inexistent cache slot to destination surface.");
            try
            {
                uint fid = this.rdpegfxAdapter.FillSurfaceByCachedBitmap(surf, RdpegfxTestUtility.largeCacheRect, RdpegfxTestUtility.cacheKey, destPointList.ToArray(), null, RdpegfxTestUtility.fillColorRed);

                //Expect the RDP client handle the negative request by dropping the connection as Windows does, or deny the request or ignore the request.
                RDPClientTryDropConnection("copy cached bitmap from an inexistent cache slot to destination surface");
            }
            catch (Exception ex)
            {
                this.TestSite.Log.Add(LogEntryKind.CheckFailed, "SUT should terminate the connection, or deny the request, or ignore the request to create duplicated surface instead of throw out an exception: {0}.", ex.Message);
            }
        }
        public void RDPEGFX_CacheManagement_PositiveTest_SurfaceToCache_MaxCacheSlot()
        {
            ushort maxCacheSlot = RdpegfxTestUtility.maxCacheSlot;

            string RDPClientVersion;

            PtfPropUtility.GetPtfPropertyValue(Site, "Version", out RDPClientVersion);
            if (string.CompareOrdinal(RDPClientVersion, "10.3") == 0) // RDP 10.3 maxCacheSlot is 4096.
            {
                maxCacheSlot = 4096;
            }

            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            if (this.isSmallCache)
            {
                maxCacheSlot = RdpegfxTestUtility.maxCacheSlotForSmallCache;
            }

            // Create a surface
            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a Surface.");
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            List <RDPGFX_POINT16> destPointList = new List <RDPGFX_POINT16>();
            RDPGFX_POINT16        pos           = new RDPGFX_POINT16(RdpegfxTestUtility.cacheRect.right, RdpegfxTestUtility.cacheRect.bottom);

            destPointList.Add(pos);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Copy a rect to cache; and copy the cached rect to surface, using max cacheSlot: {0}.", maxCacheSlot);
            uint fid = this.rdpegfxAdapter.FillSurfaceByCachedBitmap(surf, RdpegfxTestUtility.cacheRect, RdpegfxTestUtility.cacheKey, destPointList.ToArray(), maxCacheSlot, RdpegfxTestUtility.fillColorRed);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled by cached bitmap in frame: {0}, use max cacheSlot number {1}.", fid, maxCacheSlot);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface after wait 3 seconds.
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
        public void RDPEGFX_Compression_Negative_IncorrectCompressType()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.RDP8Compression_IncorrectCompressType);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.RDP8Compression_IncorrectCompressType);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Send CreateSurface message and MapSurfaceToOutPut message with incorrect compress type to client.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            RDPClientTryDropConnection("CreateSurface message and MapSurfaceToOutPut message with incorrect compress type");
        }
        public void RDPEGFX_SurfaceToSurface_Negative_DestPtsMismatch()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            // Create & output source surface, then fill it with green color
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            // Expect the client to send a frame acknowledge pdu
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Create & output destination surface
            RDPGFX_RECT16 surfRect2 = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth3, RdpegfxTestUtility.surfHeight3);
            Surface       surf2     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect2, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            Site.Assert.IsNotNull(surf, "Surface {0} is created", surf2.Id);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.SurfaceManagement_InterSurfaceCopy_DestPtsCount_Mismatch);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.SurfaceManagement_InterSurfaceCopy_DestPtsCount_Mismatch);

            try
            {
                // Send a SurfaceToSurface PDU to client with value of destPtsCount and the length of destPts doesn't match
                RDPGFX_POINT16[] destPts = { RdpegfxTestUtility.imgPos2 };   // Relative to destination surface
                this.TestSite.Log.Add(LogEntryKind.Comment, "Send a SurfaceToSurface PDU to client with value of destPtsCount and the length of destPts doesn't match.");
                fid = this.rdpegfxAdapter.InterSurfaceCopy(surf, RdpegfxTestUtility.copySrcRect, RdpegfxTestUtility.fillColorRed, surf2, destPts);

                RDPClientTryDropConnection("a SurfaceToSurface PDU to client with value of destPtsCount and the length of destPts doesn't match");
            }
            catch (Exception ex)
            {
                this.TestSite.Log.Add(LogEntryKind.TestFailed, "SUT should terminate the connection, or deny the request, or ignore the request to solid fill to inexistent surface instead of throw out an exception: {0}.", ex.Message);
            }
        }
        public void RDPEGFX_Segmentation_Negative_MultiSegmentNoSegmentArray()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.Segmentation_MultiSegments_WithoutSegmentArray);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.Segmentation_MultiSegments_WithoutSegmentArray);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill it with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth2, RdpegfxTestUtility.surfHeight2);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create the first surface and map the surface to output");
            Surface surf = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill surface with green color
            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth2, RdpegfxTestUtility.surfHeight2);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // To be modified ....
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Encode Header/Data Messages to client.");
            // byte compFlag = RdpSegmentedPdu.PACKET_COMPR_TYPE_RDP8 | RdpSegmentedPdu.PACKET_COMPRESSED;
            byte compFlag = (byte)PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_RDP8;

            Image bgImage;
            Image compImage = RdpegfxTestUtility.captureFromImage(image_64X64, RdpegfxTestUtility.imgPos,
                                                                  RdpegfxTestUtility.ccLargeBandWidth, RdpegfxTestUtility.ccLargeBandHeight, out bgImage);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Send a large size bitmap using multipart datapacking but without SegmentArray field to the client for frame {0}.", fid);
            fid = this.rdpegfxAdapter.SendUncompressedImage(compImage, RdpegfxTestUtility.imgPos.x, RdpegfxTestUtility.imgPos.y, surf.Id, PixelFormat.PIXEL_FORMAT_XRGB_8888, compFlag, RdpegfxTestUtility.segmentPartSize);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when received an invalid message.");
        }
        public void RDPEGFX_CacheManagement_Negative_CacheToSurface_InexistentCacheSlot()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            // Create a surface & output 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);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.CacheManagement_CacheToSurface_InexistentCacheSlot);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.CacheManagement_CacheToSurface_InexistentCacheSlot);

            // Build mutliple cache to surface messages to cover the surface by cacheRect
            ushort cacheW = (ushort)(RdpegfxTestUtility.largeCacheRect.right - RdpegfxTestUtility.largeCacheRect.left);
            ushort cacheH = (ushort)(RdpegfxTestUtility.largeCacheRect.bottom - RdpegfxTestUtility.largeCacheRect.top);

            ushort currRectTop = 0;

            // DestPointList is a list of positions in destination surface where the bitmap cache will copy to
            List <RDPGFX_POINT16> destPointList = new List <RDPGFX_POINT16>();

            while (currRectTop < surf.Height)
            {
                ushort currRectLeft = 0;
                while (currRectLeft < surf.Width)
                {
                    RDPGFX_POINT16 pos = new RDPGFX_POINT16(currRectLeft, currRectTop);
                    destPointList.Add(pos);
                    currRectLeft += cacheW;
                }
                currRectTop += cacheH;
            }

            // Trigger the client to copy cached bitmap from an inexsitent cache slot to destination surface
            this.TestSite.Log.Add(LogEntryKind.Comment, "Trigger the client to copy cached bitmap from an inexistent cache slot to destination surface.");
            uint fid = this.rdpegfxAdapter.FillSurfaceByCachedBitmap(surf, RdpegfxTestUtility.largeCacheRect, RdpegfxTestUtility.cacheKey, destPointList.ToArray(), null, RdpegfxTestUtility.fillColorRed);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when invalid message received.");
        }
Esempio n. 21
0
        public void RDPEGFX_CacheManagement_Negative_Default_ExceedMaxCacheSize()
        {
            this.TestSite.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ...");
            StartRDPConnection();

            this.TestSite.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEGFX ...");
            bool bProtocolSupported = this.rdpegfxAdapter.ProtocolInitialize(this.rdpedycServer);

            TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol.");

            this.TestSite.Log.Add(LogEntryKind.Debug, "Expecting capability advertise from client.");
            RDPGFX_CAPS_ADVERTISE capsAdv = this.rdpegfxAdapter.ExpectCapabilityAdvertise();

            this.TestSite.Assert.IsNotNull(capsAdv, "RDPGFX_CAPS_ADVERTISE is received.");

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending capability confirm with default capability flag to client.");
            // Set capability flag to default, then the max cache size is 100MB
            CapsFlags capFlag = CapsFlags.RDPGFX_CAPS_FLAG_DEFAULT;

            this.rdpegfxAdapter.SendCapabilityConfirm(capFlag);

            // Create & output 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);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.CacheManagement_Default_ExceedMaxCacheSize);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.CacheManagement_Default_ExceedMaxCacheSize);

            // Send message to trigger client to allocate cache slots with cache size exceed the max value 100MB
            this.TestSite.Log.Add(LogEntryKind.Comment, "Trigger client to allocate cache slots with cache size exceeds the max value 100MB");
            try
            {
                this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.largeCacheRect, RdpegfxTestUtility.cacheKey, null, RdpegfxTestUtility.fillColorRed);
                //Expect the RDP client handle the negative request by dropping the connection as Windows does, or deny the request or ignore the request.
                RDPClientTryDropConnection("allocate cache slots with cache size exceeds the max value 100MB");
            }
            catch (Exception ex)
            {
                this.TestSite.Log.Add(LogEntryKind.CheckFailed, "SUT should terminate the connection, or deny the request, or ignore the request to create duplicated surface instead of throw out an exception: {0}.", ex.Message);
            }
        }
        public void RDPEGFX_Segmentation_Positive_MultipleSegmentedPacking()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill it with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth2, RdpegfxTestUtility.surfHeight2);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill surface with green color
            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth2, RdpegfxTestUtility.surfHeight2);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Surface is filled with solid color in frame: {0}", fid);

            // Expect the client to send a frame acknowledge pdu
            // If the server receives the message, it indicates that the client has been successfully decoded the logical frame of graphics commands
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Encode Header/Data Messages to client.");
            byte compFlag = (byte)PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_RDP8;

            Image bgImage;
            Image compImage = RdpegfxTestUtility.captureFromImage(image_64X64, RdpegfxTestUtility.imgPos,
                                                                  RdpegfxTestUtility.ccLargeBandWidth, RdpegfxTestUtility.ccLargeBandWidth, out bgImage);

            // Send a big size bitmap with raw data exceeds 65535 bytes to client, multiple segmented packing are adopted for this message
            this.TestSite.Log.Add(LogEntryKind.Comment, "A large size bitmap is sent to the client using multipart datapacking for frame {0}.", fid);
            fid = this.rdpegfxAdapter.SendUncompressedImage(compImage, RdpegfxTestUtility.imgPos.x, RdpegfxTestUtility.imgPos.y, surf.Id, PixelFormat.PIXEL_FORMAT_XRGB_8888, compFlag, RdpegfxTestUtility.segmentPartSize);

            // Expect the client to send a frame acknowledge pdu
            // If the server receives the message, it indicates that the client has been successfully decoded the logical frame of graphics commands
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Delete the surface
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
        }
Esempio n. 23
0
        public void RDPEGFX_CacheManagement_PositiveTest_EvictCache()
        {
            ushort cacheSlot = 1;

            // 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.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            //Cache the surface
            this.TestSite.Log.Add(LogEntryKind.Comment, "Fill a rect on surface and cache this rect.");
            uint fid = this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.cacheRect, RdpegfxTestUtility.cacheKey, cacheSlot, RdpegfxTestUtility.fillColorRed);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            //Evict the existing cacheslot
            this.TestSite.Log.Add(LogEntryKind.Comment, "Evict the existing cache slot.");
            fid = this.rdpegfxAdapter.EvictCachEntry(cacheSlot);
            this.rdpegfxAdapter.ExpectFrameAck(fid);
            this.TestSite.Assert.IsNotNull(fid, "Evit the existing cache slog should succeed.");

            //Evict the existing cacheslot
            try
            {
                this.TestSite.Log.Add(LogEntryKind.Comment, "Evict the existing cache slot.");
                fid = this.rdpegfxAdapter.EvictCachEntry(cacheSlot);
                // this.rdpegfxAdapter.ExpectFrameAck(fid);
                this.TestSite.Assert.IsNotNull(fid, "Evit the existing cache slog should succeed.");
            }
            catch (Exception ex)
            {
                this.TestSite.Assume.Pass("Evict cache slot twice should fail as expected. The operation failed with error message: {0}.", ex.Message);
                return;
            }

            this.TestSite.Assume.Fail("Evict a cache slot twice should fail. But the RDP client did not fail the request.");
        }
Esempio n. 24
0
        public void RDPEGFX_CacheManagement_PositiveTest_SurfaceToCache_SrcRectBorderOverlapSurface()
        {
            ushort maxCacheSlot = RdpegfxTestUtility.maxCacheSlot;

            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            if (this.isSmallCache)
            {
                maxCacheSlot = RdpegfxTestUtility.maxCacheSlotForSmallCache;
            }

            // Create a surface
            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a Surface.");
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Create srcRect, in the bottom-right corner of surface
            RDPGFX_RECT16 srcRect = new RDPGFX_RECT16();

            srcRect.left   = (ushort)(RdpegfxTestUtility.surfWidth - RdpegfxTestUtility.smallWidth);
            srcRect.top    = (ushort)(RdpegfxTestUtility.surfHeight - RdpegfxTestUtility.smallHeight);
            srcRect.right  = RdpegfxTestUtility.surfWidth;
            srcRect.bottom = RdpegfxTestUtility.surfHeight;

            this.TestSite.Log.Add(LogEntryKind.Comment, "Copy a rect to cache; and copy the cached rect to surface.");
            RDPGFX_POINT16[] destPoints = new RDPGFX_POINT16[] { RdpegfxTestUtility.imgPos };
            uint             fid        = this.rdpegfxAdapter.FillSurfaceByCachedBitmap(surf, srcRect, RdpegfxTestUtility.cacheKey, destPoints, null, RdpegfxTestUtility.fillColorRed);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled by cached bitmap in frame: {0}.", fid, maxCacheSlot);

            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface after wait 3 seconds.
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
        public void RDPEGFX_SurfaceToScreen_PositiveTest_SolidFill_ManyFillRects()
        {
            uint fid;

            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill it with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Generate many fillRects on the surface
            List <RDPGFX_RECT16> rectList = new List <RDPGFX_RECT16>();

            for (ushort y = 0; y < RdpegfxTestUtility.surfHeight; y += 2)
            {
                for (ushort x = 0; x < RdpegfxTestUtility.surfWidth; x += 2)
                {
                    RDPGFX_RECT16 fillSurfRect = new RDPGFX_RECT16(x, y, (ushort)(x + 1), (ushort)(y + 1));
                    rectList.Add(fillSurfRect);
                }
            }

            // Send solid fill request to client to fill surface with green color
            fid = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, rectList.ToArray());
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}, {1} fillrects in total.", fid, rectList.Count);

            // Expect the client to send a frame acknowledge pdu
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
        public void RDPEGFX_Compression_Negative_IncorrectCompressType()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.RDP8Compression_IncorrectCompressType);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.RDP8Compression_IncorrectCompressType);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Send CreateSurface message and  MapSurfaceToOutPut message with incorrect compress type to client.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when invalid message received.");
        }
Esempio n. 27
0
        public void RDPEGFX_SurfaceToSurface_Negative_DestPtsMismatch()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            // Create & output source surface, then fill it with green color
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            // Expect the client to send a frame acknowledge pdu
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Create & output destination surface
            RDPGFX_RECT16 surfRect2 = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth3, RdpegfxTestUtility.surfHeight3);
            Surface       surf2     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect2, PixelFormat.PIXEL_FORMAT_ARGB_8888);

            Site.Assert.IsNotNull(surf, "Surface {0} is created", surf2.Id);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.SurfaceManagement_InterSurfaceCopy_DestPtsCount_Mismatch);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.SurfaceManagement_InterSurfaceCopy_DestPtsCount_Mismatch);

            // Send a SurfaceToSurface PDU to client with value of destPtsCount and the length of destPts doesn't match
            RDPGFX_POINT16[] destPts = { RdpegfxTestUtility.imgPos2 };   // Relative to destination surface
            this.TestSite.Log.Add(LogEntryKind.Comment, "Send a SurfaceToSurface PDU to client with value of destPtsCount and the length of destPts doesn't match.");
            fid = this.rdpegfxAdapter.InterSurfaceCopy(surf, RdpegfxTestUtility.copySrcRect, RdpegfxTestUtility.fillColorRed, surf2, destPts);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when received an invalid message.");
        }
        public void RDPEGFX_SurfaceToScreen_PositiveTest_FillAndMap()
        {
            uint fid;

            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface.");
            // Create a surface
            Surface surf = this.rdpegfxAdapter.CreateSurface(RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill surface with green color
            this.TestSite.Log.Add(LogEntryKind.Comment, "Fill the surface to solid green color.");
            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            fid = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}", fid);

            // Expect the client to send a frame acknowledge pdu
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            // Map surface to Output
            this.TestSite.Log.Add(LogEntryKind.Comment, "Map surface to output.");
            fid = this.rdpegfxAdapter.MapSurfaceToOutput(surf.Id, RdpegfxTestUtility.surfPos.x, RdpegfxTestUtility.surfPos.y);
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
        public void RDPEGFX_WireToSurface_PositiveTest()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            // Init for capability exchange
            RDPEGFX_CapabilityExchange();

            this.TestSite.Log.Add(LogEntryKind.Comment, "Create a surface and fill it with green color.");
            // Create & output a surface
            RDPGFX_RECT16 surfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.surfPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            Surface       surf     = this.rdpegfxAdapter.CreateAndOutputSurface(surfRect, PixelFormat.PIXEL_FORMAT_XRGB_8888);

            this.TestSite.Assert.IsNotNull(surf, "Surface {0} is created", surf.Id);

            // Send solid fill request to client to fill surface with green color
            RDPGFX_RECT16 fillSurfRect = RdpegfxTestUtility.ConvertToRect(RdpegfxTestUtility.imgPos, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);

            RDPGFX_RECT16[] fillRects = { fillSurfRect };  // Relative to surface
            uint            fid       = this.rdpegfxAdapter.SolidFillSurface(surf, RdpegfxTestUtility.fillColorGreen, fillRects);

            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface is filled with solid color in frame: {0}.", fid);
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "The bitmap is sent to the client for frame {0}.", fid);
            byte  compFlag = (byte)PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_RDP8;
            Image bgImage;
            Image compImage = RdpegfxTestUtility.captureFromImage(image_64X64, RdpegfxTestUtility.imgPos,
                                                                  RdpegfxTestUtility.smallWidth, RdpegfxTestUtility.smallHeight, out bgImage);

            fid = this.rdpegfxAdapter.SendUncompressedImage(compImage, RdpegfxTestUtility.imgPos.x, RdpegfxTestUtility.imgPos.y, surf.Id, PixelFormat.PIXEL_FORMAT_XRGB_8888, compFlag, RdpegfxTestUtility.segmentPartSize);
            this.rdpegfxAdapter.ExpectFrameAck(fid);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Verify output on SUT Display if the verifySUTDisplay entry in PTF config is true.");
            this.VerifySUTDisplay(false, surfRect);

            // Delete the surface
            this.rdpegfxAdapter.DeleteSurface(surf.Id);
            this.TestSite.Log.Add(LogEntryKind.Debug, "Surface {0} is deleted", surf.Id);
        }
        public void RDPEGFX_CacheManagement_Negative_Delete_InexistentCacheSlot()
        {
            this.TestSite.Log.Add(LogEntryKind.Comment, "Do capability exchange.");
            RDPEGFX_CapabilityExchange();

            // 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);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Set the test type to {0}.", RdpegfxNegativeTypes.CacheManagement_Delete_InexistentCacheSlot);
            this.rdpegfxAdapter.SetTestType(RdpegfxNegativeTypes.CacheManagement_Delete_InexistentCacheSlot);

            // Trigger the client to delete an inexistent cache slot
            this.TestSite.Log.Add(LogEntryKind.Comment, "Trigger the client to delete an inexistent cache slot.");
            this.rdpegfxAdapter.CacheSurface(surf, RdpegfxTestUtility.largeCacheRect, RdpegfxTestUtility.cacheKey, null, RdpegfxTestUtility.fillColorRed);

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnected = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);

            this.TestSite.Assert.IsTrue(bDisconnected, "RDP client should terminate the connection when invalid message received.");
        }
        /// <summary>
        /// Get Test Image Data
        /// </summary>
        private void GetTestData()
        {
            testData = new RdpegfxTestUtility();

            // Load clearcodec image
            String RdpegfxClearCodecImagePath;
            if (!PtfPropUtility.GetStringPtfProperty(TestSite, "ClearCodecImage", out RdpegfxClearCodecImagePath))
            {
                RdpegfxClearCodecImagePath = "";
            }

            try
            {
                testData.ClearCodecImage = (Bitmap)Image.FromFile(RdpegfxClearCodecImagePath);
            }
            catch (System.IO.FileNotFoundException)
            {
                testData.ClearCodecImage = RdpegfxTestUtility.captureFromScreen(0, 0, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            }

            // Load RfxProgressiveCodec image
            String RdpegfxRfxProgCodecImagePath;
            if (!PtfPropUtility.GetStringPtfProperty(TestSite, "RfxProgressiveCodecImage", out RdpegfxRfxProgCodecImagePath))
            {
                RdpegfxRfxProgCodecImagePath = "";
            }
            try
            {
                testData.RfxProgCodecImage = (Bitmap)Image.FromFile(RdpegfxRfxProgCodecImagePath);
            }
            catch (System.IO.FileNotFoundException)
            {
                testData.RfxProgCodecImage = RdpegfxTestUtility.captureFromScreen(0, 0, RdpegfxTestUtility.surfWidth, RdpegfxTestUtility.surfHeight);
            }
        }