Recent

Author Topic: "TestAll" and other removed example projects  (Read 3150 times)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
"TestAll" and other removed example projects
« on: November 27, 2022, 08:58:39 am »
This is a followup to a thread in Lazarus mailing list : Lazarus IDE 'testall' program
I do it in forum because David Bannon prefers it and I hope he will participate. He did the big revamp for the Examples window in the IDE and reorganized the example projects. I am happy this happened. The window was no good and the projects have accumulated during decades.
I am mostly a middleman here. The following is based on David's personal reply to me :

---
TestAll is mentioned in https://gitlab.com/dbannon/lazarus/-/issues/4
"TestAll - no OI and seems more a test app than a demonstration"

In https://forum.lazarus.freepascal.org/index.php/topic,57680.msg434184.html#msg43418  David raised two issues about including examples that were not really appropriate -

1. Ones that created components directly and did not use the Object Inspector
2. Ones that appeared more like test apps rather than a demonstration of how to do something specific for a user.

Several comments further down indicated that while including a few non-OI projects would help demonstrate the possibility, it was not really the purpose of this project to push such techniques.

Neither position was challenged. So, I assume, still without looking in the actual code, that TestAll was deemed unsuitable to include in the new Examples.

It may still be there as a "test" but not as an "example".

Obviously, its easily restored, just needs a metadata file made and to be merged back into main. The way the system works is any dir containing a project can be added to the example tree, easily found with a file browser but the new Examples Window will only play with it if it has a metadata file.
David would prefer Tests be filed under a Tests directory but sometimes the distinction between Tests and Examples is somewhat blurred.
---
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: "TestAll" and other removed example projects
« Reply #1 on: November 27, 2022, 09:29:45 am »
Tests as in unit tests are not very helpful as examples, they should merely test for correctness.
Examples provide - ideally close to - real world code in the sense that they should provide applicability.

The confusion arrives when 'tests' are not written in an appropriate manner, such that they are not actually tests.
Such tests should be removed or replaced with proper tests or moved to examples when applicable.

I think David is on the right track.

Things like TestAll can better be removed completely. It adds nothing. Tests should be specific, not generalized and testall is probably a misnomer.
« Last Edit: November 27, 2022, 09:47:17 am by Thaddy »
Specialize a type, not a var.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: "TestAll" and other removed example projects
« Reply #2 on: November 27, 2022, 10:10:54 am »

Thanks Juha, Thaddy.

Yes, I can confirm that main does not have TestAll any more. It was one of those projects that was "loose" in a directory with many others, did not, to me look like a very useful Example and was, of course even named a "test".

It either predated the Object Inspector or its author, probably sensibly considering what it does, decided to just create and initialize in code. Certainly a viable way to work, I have done so myself (ie Open and Save dialogs) but it is not, in my humble opinion, generally a good Example.

Along with 8 other projects ( https://gitlab.com/dbannon/lazarus/-/issues/4 ) I thought it out of scope but easily brought back if someone wants it. From what I could see, it could do with a bit of work first ...

If it is brought back to life, it should be a Test, not an Example. If so, just how useful a test is it ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" and other removed example projects
« Reply #3 on: November 28, 2022, 04:06:04 am »
Hello Juha, Thaddy and David,

'I' sent that initial email because at that time I was not aware of David's repository. Upon further investigation of David's repo under examples, I found the folder structure below.

-Beginner
-Components
-DBase
-Techniques

If I had known David was already restructuring and working on this I would not have sent out that initial email. There is no reason now to bring 'testall' back to life and it is there in branch fixes_2_2 for anyone who may want to go through the code and learn. So as far as I am concerned things are all good. I do have something else to ask all of you to give some thought to though.

When it comes to 'examples' what is to stop us from having another folder that says 'Dynamic' or 'Programmatically Created no OI' you get the idea? Some of the code in the 'testall' though definitely not welcoming for newbies does demonstrate useful techniques for more advanced users.

I am a great believer in the freedom to choose and this is one of the primary reasons I fell in love with Linux. All I am saying is what would be wrong with giving the end user browsing the code diverse options? Let them decide which way they want to go. By all means, use the IDE but also let them realize they have the freedom to do things without the OI and create everything dynamically through code. I like to think of doing this as giving the end user a complete set of available options they can use, we are not pushing anything :-)

If I was to start putting examples together for each component that effectively demonstrates how to access and use a given component's properties would that be a useful addition or not needed?

Aruna ( who is humbled on a daily basis in recent times and starting to appreciate and respect the vast amounts of lived experience, expertise and diverse communities that have contributed to Lazarus+FPC )

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: "TestAll" and other removed example projects
« Reply #4 on: November 28, 2022, 06:53:54 am »
If I had known David was already restructuring and working on this I would not have sent out that initial email.
Well, that would have been a shame, we want and welcome all constructive input !

When it comes to 'examples' what is to stop us from having another folder that says 'Dynamic' or 'Programmatically Created no OI' you get the idea? Some of the code in the 'testall' though definitely not welcoming for newbies does demonstrate useful techniques for more advanced users.
There are a couple of examples still in there that do demonstrate how to make a GUI without the object Inspector, search for 'Object' and you find there is a keyword, "No Object Inspector". Its just TestAll was not one of the best Examples of that genre. Maybe "dynamic creation" is another good keyword ?  Hmm.... Dynamic Component ? Not sure ....

Can we have extra Categories ? Absolutely !  The Example Window will accept any new category you define (and thats just a case of using it as Category in a Metadata file. This rewite was really about identifying suitable Beginner projects, there were complaints that a beginner was opening the first example they found and, on average, most Examples are not beginner fodder !

The other categories exist just to make it a touch easier for people browsing.

If I was to start putting examples together for each component that effectively demonstrates how to access and use a given component's properties would that be a useful addition or not needed?
Not my call Aruna but my guess is if the quality is there, they would be very welcome.

I suggest you start slow, get one together, make a metadata file and try a pull request. Its a bit sad we don't see Juha quite as much here as we used to, he is very welcoming to new comers.

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: "TestAll" and other removed example projects
« Reply #5 on: November 28, 2022, 10:19:25 am »
How about putting the TestAll project to lcl/tests directory?
As noted it looks more like a test application than an example application. Even its name includes "test".
I understood Aruna is fixing its bugs under Linux. It should be tested on many platforms before putting it back. LCL is advertised as a cross-platform library and such a test application should demonstrate it.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: "TestAll" and other removed example projects
« Reply #6 on: November 28, 2022, 11:29:27 pm »
That makes good sense. I'd prefer to see it in a dir below lcl/tests but thats just me.

Aruna, can you test on "all" platforms ?  Today that means Windows 7 (?) and Windows 11, MacOS, Intel and Arm, Linux - at least eg Ubuntu and Fedora and on at least Gnome, xfce and Plasma IMHO.

I can help you with everything there xcept the MacOS Arm.  I use VMs for most of the Linux ones, have an aging Sierra Mac and access few old Windows machines.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" and other removed example projects
« Reply #7 on: November 29, 2022, 01:19:39 am »
Can we have extra Categories ? Absolutely ! 
This is a very good thing. One is able to extend as and when required. Nice!

The Example Window will accept any new category you define (and thats just a case of using it as Category in a Metadata file. This rewite was really about identifying suitable Beginner projects, there were complaints that a beginner was opening the first example they found and, on average, most Examples are not beginner fodder !
Complaints huh? Well, I would not have been able to complain due to me being speechless after going through the code in 'TestAllForm.pp' it impressed the hell out of me when I realized most of the heavy lifting was done dynamically through code.

At the same time it scared me to death, I was thinking 'Hell No! What did this guy smoke? This is not newbie stuff. Even a seasoned Lazarus+FPC pro would have a hard time comprehending what was going on.. '

Does anyone know who wrote 'testall' in the first place? I have lots of questions but no original author to ask?

The other categories exist just to make it a touch easier for people browsing.
Yes restructuring things the way you have will definitely help, not just newbies but most folks browsing.

If I was to start putting examples together for each component that effectively demonstrates how to access and use a given component's properties would that be a useful addition or not needed?
Not my call Aruna but my guess is if the quality is there, they would be very welcome.

I suggest you start slow, get one together, make a metadata file and try a pull request. Its a bit sad we don't see Juha quite as much here as we used to, he is very welcoming to new comers.

Davo
I will start working on one single component, say a TButton for starters, and then if it delivers the quality and effectively demonstrates how each property works I guess we can move forward from there. Else I will still continue putting stuff together for my own personal learning and hopefully will help other newcomers someday. I cloned your repo so should I work with that? Or?? Let me know..

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" and other removed example projects
« Reply #8 on: November 29, 2022, 01:25:39 am »
How about putting the TestAll project to lcl/tests directory?
As noted it looks more like a test application than an example application. Even its name includes "test".
I understood Aruna is fixing its bugs under Linux. It should be tested on many platforms before putting it back. LCL is advertised as a cross-platform library and such a test application should demonstrate it.
I have it working on my Linux system. I am still testing and trying to break it. So far it has resisted all my attempts. I am not experienced enough yet to suggest where it should go but am sure that is just a technicality the team will figure out.

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" and other removed example projects
« Reply #9 on: November 29, 2022, 01:35:30 am »
That makes good sense. I'd prefer to see it in a dir below lcl/tests but thats just me.

Aruna, can you test on "all" platforms ?  Today that means Windows 7 (?) and Windows 11, MacOS, Intel and Arm, Linux - at least eg Ubuntu and Fedora and on at least Gnome, xfce and Plasma IMHO.

I can help you with everything there except the MacOS Arm.  I use VMs for most of the Linux ones, have an aging Sierra Mac and access few old Windows machines.

Davo
Oh dear, I have a few distributions in a VM I can certainly test on those. I run Classic Gnome andt xfce is a click away. Testing in all the Windows versions you have mentioned will be difficult I only have Windows 7 which I used for remote work when I was a call center agent but rarely use now.  I know I have a Raspberry Pi and Firefly lying around somewhere and a whole lot of Arduino Nano's. I can certainly test on the Pi. Or maybe just set up a VM with all required testing OS's but getting Windows will be difficult for me I really do not have the $:$$ to purchase all the required versions. I have to think about this one..

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" and other removed example projects
« Reply #10 on: November 29, 2022, 01:56:11 am »
I can help you with everything there xcept the MacOS Arm.

Davo
I did some digging and Google threw this up: https://youtu.be/6WgjQpm9VWE seems we can run MacOS in Linux using qemu. :o

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2007
  • Fifty shades of code.
    • Delphi & FreePascal
Re: "TestAll" and other removed example projects
« Reply #11 on: November 29, 2022, 01:57:08 am »
but getting Windows will be difficult for me I really do not have the $:$$ to purchase all the required versions.
For that purpose company Microsoft offers free to use evaluation versions over here.
( but I have to admit that it does not make much sense right now, they expire on February 7, 2023  :o )

Windows 10 I can offer myself it tests are needed to run.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Aruna

  • Full Member
  • ***
  • Posts: 119
Re: "TestAll" and other removed example projects
« Reply #12 on: November 29, 2022, 02:11:37 am »
but getting Windows will be difficult for me I really do not have the $:$$ to purchase all the required versions.
For that purpose company Microsoft offers free to use evaluation versions over here.
( but I have to admit that it does not make much sense right now, they expire on February 7, 2023  :o )

Windows 10 I can offer myself it tests are needed to run.
Hey that link you just sent, guess what? It says --> Windows Subsystem for Linux 2 enabled with Ubuntu installed.  :D Thank you so much KodeZwerg for offering your time to test in Windows 10. Please feel free to do so once we have established which repo we should work from and any other logistical details. I am not much for online polls but maybe we should ask the people who may be willing to test and on which platform. Also may be a good idea to ask the community what they would like to see as 'examples' for newcomers. You never know what folks may come up with  %)

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2007
  • Fifty shades of code.
    • Delphi & FreePascal
Re: "TestAll" and other removed example projects
« Reply #13 on: November 29, 2022, 02:36:28 am »
Of course I can help you guys to find bugs or unstable/incompatible things for a Windows 10 project.
I got myself latest stable Lazarus 2.2.2 (rev lazarus_2_2_2-0-g537f43754c) FPC 3.2.2 x86_64-win64-win32/win64 installed via FPC Update Deluxe program.
On my system I have that example installed, shall that be tested or a different version? If differen, please link  :-*
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: "TestAll" and other removed example projects
« Reply #14 on: November 29, 2022, 11:54:50 am »
At the same time it scared me to death, I was thinking 'Hell No! What did this guy smoke?

Yeah, it must have been good stuff !  But seriously, I reckon it was written for testing rather than demo. An, perhaps, it was written before the Lazarus Wizards got all the GUI designer in place. That is is the key to the "Rapid" bit.


I cloned your repo so should I work with that? Or?? Let me know..

My repo ?  No, no, its way out of date now, I stopped syncing it when my stuff was accepted in lazarus-main. No, go to the official source please.

Quote from: Aruna
Testing in all the Windows versions you have mentioned will be difficult I
Sorry, I was not clear, I generally test on Windows 7 and Windows 11, if something works on those ends, it must be OK in the middle. Or so I hope.

Testing arm is becoming more important but so far, touch wood, I have never found a difference between one particular distro on x86_64 and same distro on armhf. But there are, sadly, lots of differences between Linux system, mostly related to Desktops. And Wayland. Not good.  The two broad flavors of Linux, the Deb based ones and the RPM based ones do put libraries in different places. So, care with assumptions is needed.

I personally always have about ten (ok, I counted them, 36 !) Virtual Box VMs ready to go. Its an absolute pain but if you don't test and find the problems, your users will do it for you !

@KodeZwerg, you are, my friend, the Windows expert in this discussion !

The real issue here is the new work that is in -main, been there now for six months and might make it to release with the next major release of Lazarus. So, to see what we are talking about, you have to use -main.  Its dead easy to build from source (with your existing FPC) and setup to not interfere in any way with your existing install, just make sure it uses a separate PCP.  I have worked through all the examples, set them all up with  metadata and quite a lot have a keyword in that metadata "needs work".  (note - Andreas fixed one today  :D )

But you will not see all that in Lazaris 2.2.2, sorry !

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018