Markus,
Thank you, that test works and explains how to solve part of the problem with Reflection. I'd still like to know why my reflection code can't find the Ranorex libraries or link against the DLL, but for now I'll just focus on using yours since it is much simpler.
The problem I'm still facing is that the find options do not seem to be translating properly to user code, or the validation is failing for some other reason.
Here is my version of the code example from what you gave me:
Code: Select all
public void Validate_APP_Zoom()
{
TacViewLib.TacViewLibRepository myRepo = TacViewLib.TacViewLibRepository.Instance;
string methodName = "GetSite_" + picturetracknum;
MethodInfo myMethidInfo = myRepo.FormZoom.APP_ZoomInfo.GetType().GetMethod(methodName, new Type[0]);
CompressedImage myImg = (CompressedImage) myMethidInfo.Invoke(myRepo.FormZoom.APP_ZoomInfo, null);
Imaging.FindOptions myOptions = Imaging.FindOptions.Parse("1;None;127,262,115,102;True;10000000;0ms");
Validate.ContainsImage(repo.FormZoom.APP_ZoomInfo, myImg, myOptions, Validate.DefaultMessage, false);
}
When I convert one of the validation cases that I am trying to mimic to user code I get the following in my user code:
Code: Select all
public void Validate_APP_Zoom2()
{
Report.Log(ReportLevel.Info, "Validation", "(Optional Action)\r\nValidating CompareImage (Screenshot: 'Site_0103' with region {X=127,Y=262,Width=115,Height=102}) on item 'FormZoom.APP_Zoom'.", repo.FormZoom.APP_ZoomInfo);
Validate.CompareImage(repo.FormZoom.APP_ZoomInfo, APP_Zoom_Site_0103, APP_Zoom_Site_0103_Options, Validate.DefaultMessage, new Validate.Options(false, Validate.CreateScreenshot.Always));
}
And these helper methods get generated in the .cs file:
Code: Select all
CompressedImage APP_Zoom_Site_0103
{ get { return repo.FormZoom.APP_ZoomInfo.GetSite_0103(new Rectangle(127, 262, 115, 102)); } }
Imaging.FindOptions APP_Zoom_Site_0103_Options
{ get { return Imaging.FindOptions.Default; } }
The problem I have is all of these numbers for the area to compare the image are different for each image. I want to just do a compare of the entire image since each image is a single icon graphic on a plain gray background. The rectangles shouldn't matter, but they seem to as the user code fails each time. I'd like to remove the "127, 262, 115, 102" from the find options and just use the default find options.
The images getting compared seem to be identical, but the user code validation will fail. Any ideas?