feat: Initial commit of Forge package manager (Flutter + Rust)

This commit is contained in:
RarDog
2026-09-13 18:28:53 +03:00
commit e8c9d13cf1
65 changed files with 14764 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:forge/src/rust/api/packages.dart';
import 'package:forge/src/services/batch_install_service.dart';
import 'package:forge/src/services/catalog_service.dart';
void main() {
group('BatchInstallService Tests', () {
test('Correctly identifies package IDs and separates backends', () {
final batch = BatchInstallService.instance;
batch.clear();
final vlc = CatalogApp(
id: 'vlc',
name: 'VLC Media Player',
summary: 'Media player',
category: 'Media',
backend: BackendType.pacman,
fallbackIcon: CupertinoIcons.play,
);
final vscode = CatalogApp(
id: 'visual-studio-code-bin',
name: 'Visual Studio Code',
summary: 'IDE',
category: 'Development',
backend: BackendType.aur,
fallbackIcon: CupertinoIcons.chevron_left_slash_chevron_right,
);
final bottles = CatalogApp(
id: 'com.usebottles.bottles',
name: 'Bottles',
summary: 'Wine prefix manager',
category: 'Utilities',
backend: BackendType.flatpak,
fallbackIcon: CupertinoIcons.tuningfork,
);
batch.add(vlc);
batch.add(vscode);
batch.add(bottles);
expect(batch.count, 3);
expect(batch.pacmanApps.first.id, 'vlc');
expect(batch.aurApps.first.id, 'visual-studio-code-bin');
expect(batch.flatpakApps.first.id, 'com.usebottles.bottles');
batch.clear();
expect(batch.isEmpty, isTrue);
});
});
}
+37
View File
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:forge/src/rust/api/packages.dart';
import 'package:forge/src/ui/widgets/package_inspector.dart';
import 'package:macos_ui/macos_ui.dart';
void main() {
testWidgets('PackageInspectorSheet builds and displays details', (tester) async {
tester.view.physicalSize = const Size(1200, 800);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.resetPhysicalSize);
await tester.runAsync(() async {
await tester.pumpWidget(
MacosApp(
home: MacosScaffold(
children: [
ContentArea(
builder: (context, scrollController) {
return const PackageInspectorSheet(
initialPackageName: 'vlc',
initialBackend: BackendType.pacman,
);
},
),
],
),
),
);
await Future.delayed(const Duration(milliseconds: 300));
await tester.pump();
});
expect(find.text('vlc'), findsWidgets);
expect(find.text('Закрыть'), findsOneWidget);
});
}
+28
View File
@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:forge/main.dart';
void main() {
testWidgets('App loads smoke test', (WidgetTester tester) async {
tester.view.physicalSize = const Size(1200, 800);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.resetPhysicalSize);
await tester.runAsync(() async {
await tester.pumpWidget(const ForgeApp());
await Future.delayed(const Duration(milliseconds: 200));
await tester.pump();
});
expect(find.text('Forge'), findsWidgets);
// Click on 'Каталог' sidebar item
await tester.runAsync(() async {
final catalogItem = find.text('Каталог');
expect(catalogItem, findsOneWidget);
await tester.tap(catalogItem);
await tester.pump();
await Future.delayed(const Duration(milliseconds: 200));
await tester.pump();
});
});
}
+44
View File
@@ -0,0 +1,44 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:forge/src/services/app_settings_service.dart';
import 'package:forge/src/ui/theme/window_theme_style.dart';
void main() {
group('WindowThemeStyle Tests', () {
test('Palettes and properties have correct values', () {
expect(WindowThemeStyle.macos.primaryColor, const Color(0xFF0A84FF));
expect(WindowThemeStyle.gnome.primaryColor, const Color(0xFF3584E4));
expect(WindowThemeStyle.kde.primaryColor, const Color(0xFF3DAEE9));
expect(WindowThemeStyle.kde.displayName, contains('KDE Plasma'));
expect(WindowThemeStyle.gnome.displayName, contains('GNOME'));
expect(WindowThemeStyle.macos.displayName, contains('macOS'));
final kdeTheme = WindowThemeStyle.kde.buildThemeData();
expect(kdeTheme.primaryColor, const Color(0xFF3DAEE9));
expect(kdeTheme.canvasColor, const Color(0xFF232629));
expect(kdeTheme.dividerColor, const Color(0xFF4D5358));
});
test('AppSettingsService theme switching', () async {
final service = AppSettingsService.instance;
await service.setWindowTheme('macos');
expect(service.windowTheme, 'macos');
expect(service.effectiveWindowThemeStyle, WindowThemeStyle.macos);
await service.setWindowTheme('gnome');
expect(service.windowTheme, 'gnome');
expect(service.effectiveWindowThemeStyle, WindowThemeStyle.gnome);
await service.setWindowTheme('kde');
expect(service.windowTheme, 'kde');
expect(service.effectiveWindowThemeStyle, WindowThemeStyle.kde);
await service.setWindowTheme('auto');
expect(service.windowTheme, 'auto');
// On host machine or test environment, effective should match detectDesktopEnvironmentStyle()
expect(service.effectiveWindowThemeStyle, AppSettingsService.detectDesktopEnvironmentStyle());
});
});
}