-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLLMSettingsWidget_test.cpp
More file actions
82 lines (71 loc) · 2.07 KB
/
LLMSettingsWidget_test.cpp
File metadata and controls
82 lines (71 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifdef ENABLE_LOCAL_LLM
#include <gtest/gtest.h>
#include <QApplication>
#include <QCoreApplication>
#include <QTabWidget>
#include <QComboBox>
#include <QPushButton>
#include <QLabel>
#include "LLMSettingsWidget.h"
class LLMSettingsWidgetTest : public ::testing::Test
{
protected:
void SetUp() override
{
app = qobject_cast<QApplication*>(QCoreApplication::instance());
ASSERT_NE(app, nullptr);
}
QApplication* app = nullptr;
};
TEST_F(LLMSettingsWidgetTest, Constructor)
{
LLMSettingsWidget widget;
EXPECT_EQ(widget.windowTitle(), "AI Model Settings");
EXPECT_GE(widget.minimumWidth(), 500);
EXPECT_GE(widget.minimumHeight(), 450);
}
TEST_F(LLMSettingsWidgetTest, HasTabWidget)
{
LLMSettingsWidget widget;
QTabWidget* tabWidget = widget.findChild<QTabWidget*>();
ASSERT_NE(tabWidget, nullptr);
EXPECT_EQ(tabWidget->count(), 3);
}
TEST_F(LLMSettingsWidgetTest, TabNames)
{
LLMSettingsWidget widget;
QTabWidget* tabWidget = widget.findChild<QTabWidget*>();
ASSERT_NE(tabWidget, nullptr);
EXPECT_EQ(tabWidget->tabText(0), "Models");
EXPECT_EQ(tabWidget->tabText(1), "Settings");
EXPECT_EQ(tabWidget->tabText(2), "Download");
}
TEST_F(LLMSettingsWidgetTest, HasModelCombo)
{
LLMSettingsWidget widget;
QComboBox* combo = widget.findChild<QComboBox*>();
EXPECT_NE(combo, nullptr);
}
TEST_F(LLMSettingsWidgetTest, HasLoadButton)
{
LLMSettingsWidget widget;
// Find buttons by text
QList<QPushButton*> buttons = widget.findChildren<QPushButton*>();
bool hasLoad = false;
for (QPushButton* btn : buttons) {
if (btn->text().contains("Load", Qt::CaseInsensitive)) {
hasLoad = true;
break;
}
}
EXPECT_TRUE(hasLoad);
}
TEST_F(LLMSettingsWidgetTest, HasStatusLabel)
{
LLMSettingsWidget widget;
QList<QLabel*> labels = widget.findChildren<QLabel*>();
EXPECT_GT(labels.size(), 0);
}
// Test formatFileSize via indirect observation
// formatFileSize is private, but we can test behavior through the download tab UI
#endif // ENABLE_LOCAL_LLM