Commit Graph

321 Commits

Author SHA1 Message Date
Jehan ee2f86105c app: move "System Language" out of GIMP_L10N_LANGS_SIZE.
This is the only "language" from the list whose name is special and
should be localized at runtime, yet before we set any Preferences
language. It needs to be localized as the System Language itself which
will be run-dependant.

For instance, if your system is in French, it will be displayed as
"Langue système" but if you change your system to Korean, at next run,
it would show "시스템 언어". It is a per-run localization, independant
from the language selected in Preferences, and even less dependant from
build-time system language.
2024-08-15 20:57:02 +02:00
Jehan d493f0537f Issue #8900 and #9923: reimplementing GimpUnit as a proper class.
This fixes all our GObject Introspection issues with GimpUnit which was
both an enum and an int-derived type of user-defined units *completing*
the enum values. GIR clearly didn't like this!

Now GimpUnit is a proper class and units are unique objects, allowing to
compare them with an identity test (i.e. `unit == gimp_unit_pixel ()`
tells us if unit is the pixel unit or not), which makes it easy to use,
just like with int, yet adding also methods, making for nicer
introspected API.

As an aside, this also fixes #10738, by having all the built-in units
retrievable even if libgimpbase had not been properly initialized with
gimp_base_init().
I haven't checked in details how GIR works to introspect, but it looks
like it loads the library to inspect and runs functions, hence
triggering some CRITICALS because virtual methods (supposed to be
initialized with gimp_base_init() run by libgimp) are not set. This new
code won't trigger any critical because the vtable method are now not
necessary, at least for all built-in units.

Note that GimpUnit is still in libgimpbase. It could have been moved to
libgimp in order to avoid any virtual method table (since we need to
keep core and libgimp side's units in sync, PDB is required), but too
many libgimpwidgets widgets were already using GimpUnit. And technically
most of GimpUnit logic doesn't require PDB (only the creation/sync
part). This is one of the reasons why user-created GimpUnit list is
handled and stored differently from other types of objects.

Globally this simplifies the code a lot too and we don't need separate
implementations of various utils for core and libgimp, which means less
prone to errors.
2024-08-02 10:46:38 +02:00
Alx Sa 2e6938b3da app: Rename app/core GimpVectors vectors API...
...to path.
Changes the names of
gimp_vectors_* () API to
gimp_path[s]_* (). Renames related files
to [path] instead of [vectors], along with
relevant enums and functions.
2024-07-13 05:07:57 +00:00
Alx Sa e8df68fb65 libgimp, app, pdb: Rename GimpVectors to GimpPath
This commit renames the GimpVectors
object to GimpPath in both app/core and
in libgimp. It also renames the files
to gimppath.[ch] and updates the relevant
build and translation files.
There are still outstanding gimp_vectors_* ()
functions on the app side that need to be renamed
in a subsequent commit.
2024-07-12 06:16:25 +00:00
Alx Sa 853f37bed9 app: Rename app/core GimpImage vectors API...
...to paths.
Similar to d0bdbdfd, but covering the
app/core versions of the API instead of
libgimp. Changes the names of
gimp_image_*_vectors () API to
gimp_image_*_path[s] ().
Also renames some related functions such
as gimp_image_pick_path (). The next step
will be to rename the gimp_vectors_* () to
gimp_path_* ().
2024-07-11 01:17:49 +00:00
Jehan 39ea23ed52 app, libgimp, plug-ins: improve GimpVectorLoadProcedure workflow.
I'm moving the logic of choosing a correct default for width/height by adding an
"extract dimensions" callback in the procedure. The logic is that every vector
format out there should likely have metadata either for pixel dimensions or
physical dimensions, or at the very least for no-unit dimensions (ratio only).

Vector load procedures will have to implement only the extraction of such data
in a callback called by GIMP but not how to act upon them, so that we have a
common logic for all vector images.

I am implementing this callback first in the SVG plug-in, moving all the code
to extract dimensions (and improving it) in this callback.

Also I am deleting "file-svg-load-thumb" procedure. I could simply reimplement
it using the same code, but it looks to me like this is very useless for vector
formats to have a specific thumbnail procedure (unless it were to use very
specific metadata for faster result). This is vector data, just ask it directly
at the proper bounding box size.
2024-06-08 18:58:06 +02:00
Jehan 4e3792d3f1 desktop: application icons are now generated from the new logo source SVG. 2024-03-28 00:19:10 +01:00
Jehan caaee9a174 app: test should have used GeglColor already. 2024-02-11 23:28:04 +01:00
Jehan 4879ab7b7f app, libgimp, pdb, plug-ins: move more code to GeglColor.
In particular, I updated the channel and quick-mask colors, padding colors and
more.
2024-02-11 23:28:02 +01:00
Jacob Boerema 2bb0e2a636 tests: fix typo in function name 2024-01-26 13:49:48 -05:00
Jacob Boerema e1c9ec5a06 tests: mark tests skipped due to no display as skipped
We were skipping tests when there is no display, which is always the
case on Windows. However, these tests always showed as succeeded.
Unless you looked at the test log, you wouldn't noticed that most of
the tests weren't actually performed.

Exit these tests with the value GIMP_EXIT_TEST_SKIPPED instead of
EXIT_SUCCESS.
2024-01-26 13:47:20 -05:00
Jacob Boerema 064fd69f18 tests: fix #10694 test suite fails due to use of g_assert
You are not supposed to use g_assert in tests because g_assert can be
disabled using -DG_DISABLE_ASSERT, which makes tests fail.

Instead let's use the recommended replacement g_assert_true. At this
time we are not bothering using more specific g_assert_* functions,
since there are plans to change our test suite.
2024-01-26 13:44:30 -05:00
Jacob Boerema f78186e03b Get rid of old Windows specific defines
MINGW64
- uses 0x601 as value for _WIN32_WINNT. No need for us to define
it to that value or even lower values in some places.
This also gets rid of:  warning: "_WIN32_WINNT" redefined
- has 0x0502 for WINVER, so get rid of us setting it to 0x0500 in
gimp-app-test-utils.h. It also seems that the need to use G_OS_WIN32
has disappeared here.
- DIRECTINPUT_VERSION is 0x0800, no need for us to set it to that value.
- AI_ADDRCONFIG was apparently missing from the MINGW headers in the
past, but not anymore.
2024-01-24 12:10:00 -05:00
Anders Jonsson e3896352b9 app: fix test-ui typo 2024-01-23 20:46:01 +00:00
Jacob Boerema 7a8f465b2d Issue #10588: enumerations for RotationType can't be used in Python
Due to GObject Introspection we can't have the last part of an
identifier start with a digit, since that part will be used in Python
as the identifier, and Python doesn't allow that to start with a digit.
e.g. GIMP_ROTATE_90 would be used in Python as
image.rotate(Gimp.RotationType.90)

To fix this we add DEGREES in front of the number, without a '_',
even though that looks ugly.
2024-01-05 13:28:49 -05:00
Jehan d88f6f9733 app, devel-socs, icons, plug-ins, tools: remove various autotools artifacts.
* generate-icon-makefiles.py was a tool to generate the icon-list.mk files.
* mkgen.pl was used to generate plug-ins/common/Makefile.am
2023-09-27 15:39:39 +02:00
psykose 300ce655c3 create_test_env.sh: use sh instead of bash
this is actually a regular sh-portable script, and this prevents needing
bash at build time or for tests (for packaging from tarballs)
2023-07-23 21:06:49 +00:00
Michael Natterer 26dce72d2c Remove autotools 2023-05-27 00:03:52 +02:00
Simon Budig 997e4b5f6c test-ui: re-enable one of the tests, our gtk-dependency is big enough now. 2023-05-21 01:22:00 +02:00
Simon Budig 36eda4ae9c fix some warning related warnings 2023-05-20 18:25:10 +02:00
Jehan c7c5f126b1 app: disable some unit tests temporarily.
Since the recent changes, these 3 tests are not working:
- tools
- session-2-8-compatibility-multi-window
- session-2-8-compatibility-single-window

(the 2 latters were only working with xvfb anyway)

I could just dig further as I did a bit these last few days, and tweak more and
more the testing code. But I think our current unit-testing framework is just
non-reliable and for all these years, we have spent more time fixing the tests
than actually relying on them to tell us there is a bug in GIMP.
Furthermore creating new tests is so cumbersome that basically none do it.

I have a plan laid out in #9339 for a much better and more reliable unit testing
infrastructure, based on the GIMP executable itself and a very simple syntax to
create new test scenari (so that even non-developers should be able to create
them eventually). So until then, let's disable these tests and stop wasting
time.
2023-04-12 22:07:09 +02:00
Jehan 817ee1c660 app, docs, etc.: transform menurc in shortcutsrc after an update.
Also get rid of various old references to menurc and don't install it anymore to
etc/ (neither the new shortcutsrc as it doesn't look like it brings much value
to do so).
2023-04-12 22:07:09 +02:00
Jehan d4fb4362c9 app: fix unit tests with GUI.
Run them with the new GApplication logic, otherwise the various new
parts (such as actions) are not properly loaded.
2023-04-12 22:07:09 +02:00
Jehan 38d0abc026 app: prevent multiple registrations of a same action.
Pre-GIMP-3.0 code logics would re-allocate several GimpMenuFactory or
GimpUIManager for no good reason. While it was still working with old GtkAction
code, with our new GAction-based code, we were ending up overriding an action
with a new version of the same action, while keeping reference to old actions.
This made for discrepancies of the enabled or visible state of actions.

The new code keeps singleton of some objects and references to already
registered GimpUIManager or GimpActionGroups objects and make sure no actions
with the same name are created twice.
2023-04-12 22:07:09 +02:00
Jacob Boerema f9217862cf app, tests: fix not running tools tests under meson
The meson build had the tools tests disabled unlike the autotools build.
Since enabling them doesn't cause any problems, let's enable them for
meson too.
2023-03-26 13:26:57 -04:00
Jacob Boerema a62cad35be app, meson: fix single window test failure
Our CI meson tests for single window failed even though the sessionrc
looked the same as the one created by the autotools tests.

Looking at the Makefile.am it explicitly states that the tests shouldn't
be run in parallel or in a different order than specified, which was not
the case in our meson build.

We change this by setting is_parallel to false for each build, and
setting a different priority for each test. Since higher priority values
execute first we count down.
2023-03-26 13:26:57 -04:00
Jordi Mallach 1aec2281f5 Increase the timeout of tests from default 30s to 60s.
Some slower architectures hit the timeouts and fail their build.

See
https://buildd.debian.org/status/fetch.php?pkg=gimp&arch=armel&ver=2.99.14-1&stamp=1669046159&raw=0
for an example of a failed build.
2022-11-22 10:01:44 +01:00
Jehan ca230cb770 meson: fix warnings of deprecated features.
Now that we bumped our meson requirement, meson is complaining about
several features now deprecated even in the minimum required meson
version:

s/meson.source_root/meson.project_source_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.

s/meson.build_root/meson.project_build_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.

Fixing using path() on xdg_email and python ExternalProgram variables:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead

s/get_pkgconfig_variable *(\([^)]*\))/get_variable(pkgconfig: \1)/ to
fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead
2022-08-31 01:29:37 +02:00
Jehan 2ac483f9e3 meson: make run_command() calls future-proof.
Some of our calls to run_command() would have failed with future
versions of meson if we didn't set the "check" parameter. In particular,
in various calls, we don't want to fail the whole build configuration
when the command does (as it's an optional feature check). In such a
case, it is important to be explicit as future will default to fail
then.

Fixes:

> WARNING: You should add the boolean check kwarg to the run_command call.
>          It currently defaults to false,
>          but it will default to true in future releases of meson.
>          See also: https://github.com/mesonbuild/meson/issues/9300
2022-07-31 18:23:00 +02:00
Jan Tojnar 3279bb3351 tools: Use env in shebangs
Having perl and bash in /usr/bin/ is less common than having them on PATH
(e.g. Nix does not have them there).
2022-03-18 16:05:58 +00:00
Jehan ee26a39049 app: replace gimp_parasite_data*() with gimp_parasite_get_data(). 2021-01-29 23:52:03 +01:00
Jehan 6dae2c1d33 app: remove unused function.
gimp_ui_get_dialog() is not used anymore anywhere.
2020-09-21 21:00:30 +02:00
Jehan ec26bc44ae app: (meson) create_test_env.sh was not run.
The script `create_test_env.sh` was registered in meson as a run target
(i.e. to be run manually by `ninja create_test_env`), which is really
not useful. So a `ninja test` was outputting various:

> You have a writable data folder configured (/gimp/build/dir/app/tests/gimpdir-output/gradients),
> but this folder does not exist. Please create the folder or fix your
> configuration in the Preferences dialog's 'Folders' section.

Unfortunately run target are only meant to be run from command lines and
cannot be used in 'depends' argument of test() or 'dependencies' of
executable() because "in Meson all dependencies are to output files, not
to concepts" (cf. https://github.com/mesonbuild/meson/issues/1793).

So instead a run_target() just directly use a run_command() and make
this script run during configuration step. Also make the shell script
executable as it was not.

See also #5666 as it was one of the errors outputted by the reporter's
log (though probably not the main issue).
2020-09-20 13:20:29 +02:00
Jehan 2956873740 app, libgimp, pdb: fix gimp_selection_float() usage.
This fixes bugs introduced in commit a7c59277fb where I obviously didn't
properly checked all the places where gimp_selection_float() was used
after its parameters changed.
2020-05-18 02:09:45 +02:00
Jehan 5cf71f3220 app: test-ui multi-layer aware.
This is actually commented-out test code, but still to be thorough in
case we ever re-enable this code.
2020-05-17 18:57:32 +02:00
Niels De Graef 0352559efa meson: Allow running tests headless
This commit makes sure we can properly run the tests in a headless
environment, i.e. they don't mess with the user's X display or their
session bus. The latter is also needed for parallel tests as they fail
to simultaneously own the same name on the session bus.

Replaced the "xvfb-run" meson option with the "headless" option, which
is more intuitive (and also more correct, since we now also require
`dbus-run-session` to run the tests, not only `xvfb-run`).

Finally, note that we need a version of `xvfb-run` that supports the
`-d` (`--auto-display`) option. The problem with `--auto-servernum`
which is also regularly used, is that it doesn't shut down cleanly,
returning a non-zero exit code, wich makes the test fail.

Fixes https://gitlab.gnome.org/GNOME/gimp/-/issues/5078
2020-05-14 18:31:08 +02:00
Niels De Graef ddfae277cb meson: Cleanup and fix issues using libapp_dep
Meson has a very useful tool for combining a set of linked libraries and
compiler arguments (like an internal pkg-config):
`declare_dependency()`. Use this command to ensure that we can easily
reuse libapp* over multiple libraries, executables and tests.

That way, if we also add a new dependency later on in one of the libapp
libraries, this won't need to be added multiple times.
2020-05-11 10:52:23 +00:00
Niels De Graef 8b0dfb99d5 app/test-xcf: include necessary headers for close() 2020-05-11 10:52:23 +00:00
Niels De Graef 5f117d0561 meson: Fix envvar in tests
`GIMP_TESTING_ABS_TOP_SRCDIR` is supposed to point to the top source root directory, not the top build directory.
2020-05-11 10:52:23 +00:00
Niels De Graef 3a167243b9 meson: Fix building of tests
The tests weren't building because they weren't linked to the static
libraries.

Note that some tests still need fixing, but at least they can be
built/run now.
2020-05-11 10:52:22 +00:00
Oleksii Samorukov 6b5d1a0d46 Fix reference from gimp_param_spec_duplicate to gimp_config_param_spec_duplicate 2020-01-17 11:17:03 +01:00
Jehan 9a043d0fc9 Issue #4251: (meson) dbus-glib-1 not required.
As written in previous commit, this is not a dependency since commit
c4460e84.
2019-11-16 19:26:58 +01:00
Jehan 5f2a6940e3 app, devel-docs: remove dangling DBUS_GLIB_* variables.
dbus-glib is no more a dependency since commit c4460e84, i.e. already
since 2013!
2019-11-16 19:19:02 +01:00
Ell 549a606b2f app: don't use the deprecated GTimeVal in gimp-test-session-utils.c
GTimeVal, as well as g_file_info_get_modification_time(), have been
deprecated in GLib 2.62.  Use g_file_info_get_attribute_uint64()
instead.
2019-10-26 22:33:20 +03:00
Michael Natterer 1bca89163d libgimpbase: remove gimp_personal_rc_file()
and port its remaining users to gimp_directory_file().
2019-09-21 18:08:13 +02:00
Michael Natterer 7fa730b1c7 app: make tests build again after file_open_image() signature change 2019-09-12 00:05:17 +02:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Michael Natterer 967cbb4fad app: use the GParamSpec's name in gimp_pdb_dump()
and remove gimp_pdb_compat_arg_type_from_gtype(). The core is now free
of PDB legacy code.
2019-08-30 11:43:53 +02:00
Michael Natterer 32ea28b6b1 app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
  information needed for constructing all GParamSpecs we use, don't
  use GimpPDBArgType in GPProcInstall but an enum private to the wire
  protocol plus the GParamSpec's GType name. Bump the wire protocol
  version.

- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
  take care of converting between GPParamDef and GParamSpec. They
  share code as far as possible.

- Change pluginrc writing and parsing to re-use GPParamDef and the
  utility functions from gimpgpparamspecs.

- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
  the entire core uses proper GParamSpecs from the wire protocol now,
  the whole file will follow down the drain once we use a GValue
  representation on the wire too.

- In gimp_plug_in_handle_proc_install(), change the "run-mode"
  parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
  already an enum). and change all places in app/ to treat it as an
  enum value.

- plug-ins: fix cml-explorer to register correctly, a typo in
  "run-mode" was never noticed until now.

- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
  between old-style wire communication and using GParamSpec and
  GValue, it contains some functions that are subject to change or
  even removal in the next steps.

- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
  able to actually install procedures the new way.

- plug-ins: change goat-exercise to completely use the new GimpPlugIn
  and GimpProcedure API, look here to see how plug-ins will look in
  the future, of course subject to change until this is finished.

- Next: changing GPParam to transmit all information about a GValue.
2019-07-28 17:34:40 +02:00
Michael Natterer 696691efbd app: fix tests by using the right value in sessionrc-expected-multi-window
Apparently GTK3 is more reliable when it comes to remembering window sizes.
2019-07-23 13:16:23 +02:00