dolphinsmalltalk / Dolphin

Dolphin Smalltalk Core Image
MIT License
301 stars 58 forks source link

Gdiplus.Image & Gdiplus.Bitmap broken class example methods #1109

Closed FBek055 closed 3 years ago

FBek055 commented 3 years ago

Describe the bug Graphics.Gdiplus.Image and Graphics.Gdiplus.Bitmap have a number of broken Class Examples, 'exampleGdiplxx' due to missing resourcee, e.i., pafEye.jpg & _pafRgb0000FF100x100bmp & pafSeattleNightJpg & fish32x32pngBytes & pafWinXP32x32ico ...

To Reproduce Steps to reproduce the behavior:

  1. Starting with Graphics.Gdiplus.Image >> exampleGdipIFlags
  2. See error in status line 'Warning undefined selector #pafEye.Jpg'
  3. note: there seem to be other errors as well purely due to the new namespace, e.g., "Error: undeclared 'RichTextPresenter'" in the same example.
  4. Other broken methods in Image class include: exampleGdipIInterpMode, exampleGdipIJPEGCompression, exampleGdipILosslessRotation, etc...
  5. Broken methods in Bimap class start from: exampleGdipBFromByteArray, exampleGdipBFromXPIcon, etc...

Expected behavior Restore or replace missing resources to ensure all class examples will execute without errors. A system wise auto-testing of class examples would also be handy.

Please complete the following information):

Additional context Class examples are very valuable, it would really be handy to include as many as possible, in a systematic way, to showcase the various features, especially given the limited availability of other forms of documentation. Could this be a valid alternate form of built-in comprehensive documentation? (I presume most of them are written anyway, at an early stage of a class development, as a first means to check the functionality). If all class examples could be made to follow a unified protocol, finding and testing them could be easily automated.

blairmcg commented 3 years ago

If you look in the Transcript, you should see this message:

GdiplusTests package needs to be installed for this example to work.

Which hopefully is self explanatory, although it should be an error rather than a notification, or it is liable to be overlooked.

A system wise auto-testing of class examples would also be handy.

They are all tested. The original authors who contributed the package decided to package the resources this way in order to take advantage of SUnit resources as part of also testing the examples. Given that these particular examples don't work without the tests it might have been better that they were put in the test package, or alternately that the resources were not, but it is more inconvenient than broken. I would recommend always loading the tests (see readme), as one of their uses is as a source of examples.

FBek055 commented 3 years ago

Thanks for the quick response and clarifications, fair enough.

I may have missed a beat, as a beginner, are you referring to running TestDPRO.cmd which presumably loads all test packages? I could not find any reference to a GdiplusTests package otherwise.

blairmcg commented 3 years ago

Just 'File/File in...' the RegressionTestsLoad.st script file, or open the script that is run by TestDPRO.cmd, RegressionTestsRun.st, and evaluate this bit:

SourceManager default fileIn: 'RegressionTestsLoad.st'
FBek055 commented 3 years ago

OK, I had to rebuild Dolphin to ensure a clean setup, run TestDPRO.cmd to ensure all is checked, then File in RegressionTestsLoad.st using Source Browser. The broken resource issue is now resolved. Thanks for the support