From 4e1b49c3d593d04fa9970f1a0d59d9ef0a661a5b Mon Sep 17 00:00:00 2001
From: "Alexander V. Wolf" <alex.v.wolf@gmail.com>
Date: Wed, 26 Mar 2025 21:18:07 +0700
Subject: [PATCH] Fix astrometry tests (fix #4246)

---
 src/tests/testAstrometry.cpp | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/src/tests/testAstrometry.cpp b/src/tests/testAstrometry.cpp
index f5e07b4c81445..5a2e7a448b655 100644
--- a/src/tests/testAstrometry.cpp
+++ b/src/tests/testAstrometry.cpp
@@ -33,33 +33,15 @@ QTEST_GUILESS_MAIN(TestAstrometry)
 void TestAstrometry::initTestCase()
 {
     // Define the directory to search in
-    QDir dir(QDir::currentPath());
+    QDir dir(STELLARIUM_SOURCE_DIR);
     // make a list of star catalog files stars_0_*.cat, stars_1_*.cat, stars_2_*.cat and stars_3_*.cat
     QStringList filters;
     filters << "stars_0_*.cat" << "stars_1_*.cat" << "stars_2_*.cat" << "stars_3_*.cat";
     QStringList files;
     QString file;
 
-    while (!dir.isRoot())  // check directory one by one if the current directory contains star catalog files
-    {
-        // check if at least one "stars_*.cat" file exist under the directory
-        if (dir.exists("stars/hip_gaia3"))  // check if the directory exists, if yes go in to check
-        {
-            dir.cd("stars/hip_gaia3");
-            dir.setNameFilters(QStringList() << filters[0]);
-            files = dir.entryList(QDir::Files);
-            if (!files.isEmpty())  // in case the directory does not contains any star catalog file
-            {
-                break;
-            }
-            else
-            {
-                // go back to the parent directory and keep searching
-                dir.cd("../../");
-            }
-        }
-        dir.cdUp();  // one level up at a time
-    }
+    // Go to star catalog directory...
+    dir.cd("stars/hip_gaia3");
 
     // assert the directory exists
     QVERIFY2(dir.exists(), "Star catalog directory does not exist! Can't perform the rest of the tests.");
