File indexing completed on 2024-05-19 05:41:56
0001 // mainwindow_load_test_crash.t.cpp -*-C++-*- 0002 0003 /* Copyright 2023 Codethink Ltd <codethink@codethink.co.uk> 0004 // SPDX-License-Identifier: Apache-2.0 0005 // 0006 // Licensed under the Apache License, Version 2.0 (the "License"); 0007 // you may not use this file except in compliance with the License. 0008 // You may obtain a copy of the License at 0009 // 0010 // http://www.apache.org/licenses/LICENSE-2.0 0011 // 0012 // Unless required by applicable law or agreed to in writing, software 0013 // distributed under the License is distributed on an "AS IS" BASIS, 0014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0015 // See the License for the specific language governing permissions and 0016 // limitations under the License. 0017 */ 0018 0019 #include <ct_lvtqtc_graphicsscene.h> 0020 #include <ct_lvtqtc_graphicsview.h> 0021 #include <ct_lvtqtc_lakosrelation.h> 0022 #include <ct_lvttst_fixture_qt.h> 0023 0024 #include <apptesting_fixture.h> 0025 #include <catch2-local-includes.h> 0026 #include <variant> 0027 0028 #include <preferences.h> 0029 0030 // in a header 0031 Q_DECLARE_LOGGING_CATEGORY(LogTest) 0032 0033 // in one source file 0034 Q_LOGGING_CATEGORY(LogTest, "log.test") 0035 0036 using namespace Codethink::lvtldr; 0037 0038 // TODO: Resolve the test below after task 651 is fixed. 0039 TEST_CASE_METHOD(CodeVisApplicationTestFixture, "Loading Project Leads to crash") 0040 { 0041 Preferences::self()->useDefaults(true); 0042 0043 // We need a default tab widget to display elements on the view. 0044 REQUIRE(hasDefaultTabWidget()); 0045 0046 const bool isOpen = window().openProjectFromPath("testcrash.lks"); 0047 REQUIRE(isOpen); 0048 0049 QTest::qWait(100); 0050 0051 clickOn(PackageTreeView::Package{"abc"}); 0052 QTest::qWait(1000); 0053 0054 // if this passes, we are not crashing. 0055 }