Adding XojoUnit results in errors

Hello, everyone. I’m very new to Xojo. I just started my first project, created a class and a method. I run the project and everything works and I see the app’s window.

I then downloaded XojoUnit from GitHub, opened up the desktop project. It builds and runs as expected. I then copied the XojoUnit folder to my own project.

Now when I try to run the project, I immediately get an error: “You cannot have a Menu Bar that contains DesktopMenuItems when the project contains deprecated Windows. Convert all Windows to DesktopWindows first.”

The XojoUnit windows (XojoUnitAboutWindow and XojoUnitTestWindow) both have supers set to Window.

The XojoUnit version I have is 6.8.

What should I do?

You shouldn’t copy then entire project, just the class(es) that comprise XojoUnit. Open both your project and the XojoUnit example, then copy the classes into your project.

It’s a clash between the old classes used to create XojoUnit and the new classes in your project. Until we update it, you can manually change the super classes of the offending objects to prefix “Desktop”.

For example, change the super class of both windows from “Window” to “DesktopWindow”.

I changed the super class of a couple of windows to “DesktopWindow.” Also a couple of toolbars to API 2.0.

But now I’m getting other errors (see below).

Any ideas when XojoUnit will be updated?

Regarding the first error, that means two Method withs the same name exist, the name being ColumnTypeAt. That’s ok to have many methods with the same name, but the siganures must be different. The signature is made of the quantity of parameters and their variable type, as well as the type of the value returned by the method. Here is an example with a method that would be called MyMethod:

MyMethod ( p1 as Integer, p2 as String, p3 as Double as Double ' no_1
...
MyMethod ( p1 as String, p2 as Integer()) as Integer ' no_2
...
MyMethod ( p1 as Integer, p2 as String, p as Double) as Double ' no_3
...
MyMethod ( p1 as String) as String() ' no_4
...

Let’s have a look at these methods, top to bottom:

  • no_1 is perfectly correct with its three parameters and return value;
  • no_2 is also fine with its two parameters and return value;
  • no_3 is wrong because the three parameters are the same (same type), there is no way the compiler could differentiate them;
  • no_4 is correct even if it does not return anaything

HTH

The return type is not taken into account, just the parameters.

1 Like

Those are XojoUnit errors. I’m afraid fixing these are beyond my current Xojo pay-grade. :slight_smile:

I opened ‘XojoUnitDesktop.xojo_project’ in latest version of Xojo. Saved as new project. Fixed the errors and then copied ‘Xojounit’.