plasma-workspace: vendor as full-fork recipe (path=source, patches baked)

This commit is contained in:
2026-08-01 04:44:32 +03:00
parent 9dc3e48860
commit ad41dde1fd
7954 changed files with 1820768 additions and 2 deletions
@@ -5,8 +5,13 @@ version = "6.7.2"
#TODO: plasma-workspace — KDE Plasma shell. Depends on kwin + all KF6 + dbus.
# Blockers: kwin, kf6-kio, kf6-kxmlgui, plasma-framework (all need DBus + OpenGL)
[source]
tar = "https://download.kde.org/stable/plasma/6.7.2/plasma-workspace-6.7.2.tar.xz"
blake3 = "ef78b0f4ebee9b888a69a7c8c3391ac6b8ff24045b5a2d78efdf77b6b0a19bd2"
# Vendored local fork (full-fork model): builds from the committed source/
# tree (offline, reproducible). source/ = pristine upstream + the patches below
# BAKED IN. .patch files kept tracked so a version bump can re-apply them via
# sync-recipe-source.sh.
# upstream: https://download.kde.org/stable/plasma/6.7.2/plasma-workspace-6.7.2.tar.xz
# blake3: ef78b0f4ebee9b888a69a7c8c3391ac6b8ff24045b5a2d78efdf77b6b0a19bd2
path = "source"
[build]
template = "custom"
@@ -0,0 +1,4 @@
[General]
disableUnqualifiedAccess = "i18n,i18nc,i18nd,i18ndc,i18ncp,i18np,xi18nc,kcm"
warnOnUsage = "plasmoid"
disableHeuristic = false
@@ -0,0 +1,15 @@
# clang-format
823d2106ec3e12512de8af6b713dab470e307db2
ee189e715db6e09c2e6dc58febe41b8bb77a70c9
f7b556dddfd795e808d65edae649f0e03e3583f3
894c5a1b9164252ea5d9fb7ea8ee46ee0711f285
ecd404956b0e102e753ef0c3a38b9cf3e9f8bea8
5ad0abb76b0c4e391794c09c9233afa0a2962600
53bf32941c36ae30b9ecbb9c92f1bdeb4739baae
856c9ec33b12f002456347a015a37036a5ee9f2e
1137a71c0720cb0929d077f591b850f0275881d9
fcb7c8db387b166a0798e9c042022219ba3798ee
235c0872c3f41cdbe7cc31980be2dab15919ba4c
8ff50604ef4433709a67ec5b7ddff8ff9f633797
a71a52be44946cf06698819f32a09bbac8b0b086
3b9472c3a4ca7e63ad94557bfd2d2accdecf38a1
@@ -0,0 +1,32 @@
# Ignore the following files
*~
*.[oa]
*.diff
*.kate-swp
*.kdev4
.kdev_include_paths
*.kdevelop.pcs
*.moc
*.moc.cpp
*.orig
*.user
.*.swp
.swp.*
Doxyfile
Makefile
avail
random_seed
/build*/
CMakeLists.txt.user*
*.unc-backup*
.idea
.clang-format
/build*/
/compile_commands.json
.clangd
/cmake-build*
.cache
.vscode
.qmlls.ini
*.pyc
__pycache__/
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: None
# SPDX-License-Identifier: CC0-1.0
include:
- project: sysadmin/ci-utilities
file:
- /gitlab-templates/linux-qt6.yml
- /gitlab-templates/linux-qt6-next.yml
- /gitlab-templates/freebsd-qt6.yml
- /gitlab-templates/xml-lint.yml
- /gitlab-templates/yaml-lint.yml
- /gitlab-templates/qml-lint.yml
suse_tumbleweed_qt611_reduced_featureset:
extends: suse_tumbleweed_qt611
script:
- git config --global --add safe.directory $CI_PROJECT_DIR
- python3 -u ci-utilities/run-ci-build.py --project $CI_PROJECT_NAME --branch $CI_COMMIT_REF_NAME --platform Linux --extra-cmake-args="-DWITH_X11=OFF -DCMAKE_DISABLE_FIND_PACKAGE_KSysGuard=ON -DCMAKE_DISABLE_FIND_PACKAGE_QALCULATE=ON" --skip-publishing --only-build
@@ -0,0 +1,42 @@
<!-- Thank you for submitting a merge request to make KDE Software better! Use the information from the commit message(s) to fill in the template below.
(For future reference, follow the guidelines at https://cbea.ms/git-commit/#seven-rules)
-->
### Original commit message(s)
%{all_commits}
### Reason for the change
<!--
If this merge request change is resolving a problem, describe the problem and explain why the approach taken here is the correct way to resolve it.
If the merge request adds a new feature or UI change, explain the benefits of the change.
-->
### Test plan
<!--
Extend any related autotests with new test cases to validate your changes. If none exist, consider adding one if you have the technical skills to do so.
Otherwise, at least describe how you tested the change, and how someone reviewing this merge request can test it themselves. No need to mention obvious things like "Apply the changes".
-->
### Screenshots or screen recordings
<!--
If this merge request introduces a visual change, please add before-and-after screenshots in the following format:
| Before | After |
| ------ | ----- |
| [drag "before" screenshot here] | [drag "after" screenshot here] |
-->
### Bugs fixed
<!--
If the changes in this merge request fix any Bugzilla tickets, add the following keyword for each one:
BUG: [number of the bug report]
-->
@@ -0,0 +1,2 @@
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2024 Nate Graham <nate@kde.org>
@@ -0,0 +1,93 @@
# SPDX-FileCopyrightText: None
# SPDX-License-Identifier: CC0-1.0
Dependencies:
- 'on': ['@all']
'require':
'frameworks/attica': '@latest-kf6'
'frameworks/baloo': '@latest-kf6'
'frameworks/extra-cmake-modules': '@latest-kf6'
'frameworks/kauth': '@latest-kf6'
'frameworks/kbookmarks': '@latest-kf6'
'frameworks/kcmutils': '@latest-kf6'
'frameworks/kcodecs': '@latest-kf6'
'frameworks/kcompletion': '@latest-kf6'
'frameworks/kconfig': '@latest-kf6'
'frameworks/kconfigwidgets': '@latest-kf6'
'frameworks/kcoreaddons': '@latest-kf6'
'frameworks/kcrash': '@latest-kf6'
'frameworks/kdbusaddons': '@latest-kf6'
'frameworks/kdeclarative': '@latest-kf6'
'frameworks/kfilemetadata': '@latest-kf6'
'frameworks/kglobalaccel': '@latest-kf6'
'frameworks/kguiaddons': '@latest-kf6'
'frameworks/ki18n': '@latest-kf6'
'frameworks/kiconthemes': '@latest-kf6'
'frameworks/kio': '@latest-kf6'
'frameworks/kitemmodels': '@latest-kf6'
'frameworks/kitemviews': '@latest-kf6'
'frameworks/kjobwidgets': '@latest-kf6'
'frameworks/knewstuff': '@latest-kf6'
'frameworks/knotifications': '@latest-kf6'
'frameworks/kpackage': '@latest-kf6'
'frameworks/kparts': '@latest-kf6'
'frameworks/krunner': '@latest-kf6'
'frameworks/kservice': '@latest-kf6'
'frameworks/ktexteditor': '@latest-kf6'
'frameworks/ktextwidgets': '@latest-kf6'
'frameworks/kwallet': '@latest-kf6'
'frameworks/kwidgetsaddons': '@latest-kf6'
'frameworks/kwindowsystem': '@latest-kf6'
'frameworks/kxmlgui': '@latest-kf6'
'frameworks/solid': '@latest-kf6'
'frameworks/sonnet': '@latest-kf6'
'frameworks/kholidays': '@latest-kf6'
'frameworks/kquickcharts': '@latest-kf6'
'frameworks/kded': '@latest-kf6'
'frameworks/prison': '@latest-kf6'
'frameworks/kstatusnotifieritem': '@latest-kf6'
'frameworks/kuserfeedback': '@latest-kf6'
'frameworks/kcolorscheme': '@latest-kf6'
'plasma/kwayland': '@same'
'plasma/libplasma': '@same'
'plasma/layer-shell-qt': '@same'
'plasma/kglobalacceld': '@same'
'plasma/kscreenlocker': '@same'
'plasma/libkscreen': '@same'
'plasma/libksysguard': '@same'
'plasma/plasma-nano': '@same'
'plasma/plasma-activities': '@same'
'plasma/plasma-activities-stats': '@same'
'plasma/knighttime': '@same'
'plasma/kwin': '@same'
'libraries/plasma-wayland-protocols': '@latest-kf6'
'libraries/kirigami-addons': '@latest-kf6'
'graphics/libkexiv2': '@latest-kf6'
'third-party/appstream': '@latest'
'third-party/qcoro': '@latest'
'third-party/wayland': '@latest'
'third-party/wayland-protocols': '@latest'
- 'on': ['Linux']
'require':
'frameworks/networkmanager-qt': '@latest-kf6'
'libraries/polkit-qt-1': '@latest-kf6'
'third-party/packagekit-qt': '@latest'
RuntimeDependencies:
- 'on': ['Linux']
'require':
'network/kio-extras': '@latest-kf6'
'plasma/kactivitymanagerd': '@same'
'sdk/selenium-webdriver-at-spi': '@same'
- 'on': ['Linux', 'FreeBSD']
'require':
'frameworks/qqc2-desktop-style': '@latest-kf6'
'plasma/milou': '@same'
Options:
use-ccache: True
require-passing-tests-on: ['@all']
clang-format-versions: [14, 18]
run-qmllint: True
gcovr-arguments: '--merge-mode-functions=separate'
@@ -0,0 +1 @@
plasma-workspace-6.7.2.tar.xz
@@ -0,0 +1,24 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: plasma-workspace
Upstream-Contact: KDE <community@kde.org>
Source: https://invent.kde.org/plasma/plasma-workspace
Files: wallpapers/image/plugin/autotests/testdata/*
Copyright: None
License: CC0-1.0
Files: appiumtests/applets/mediacontrollertest/*
Copyright: None
License: CC0-1.0
Files: applets/cameraindicator/metadata.json
Copyright: None
License: CC0-1.0
Files: kcms/cursortheme/autotests/data/*
Copyright: None
License: CC0-1.0
Files: kcms/soundtheme/autotests/data/*
Copyright: None
License: CC0-1.0
@@ -0,0 +1,491 @@
cmake_minimum_required(VERSION 3.16)
project(plasma-workspace)
set(PROJECT_VERSION "6.7.2")
string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION})
list(GET VERSION_LIST 0 PROJECT_VERSION_MAJOR)
list(GET VERSION_LIST 1 PROJECT_VERSION_MINOR)
list(GET VERSION_LIST 2 PROJECT_VERSION_PATCH)
set(PROJECT_DEP_VERSION "6.7.0")
set(QT_MIN_VERSION "6.10.0")
set(KF6_MIN_VERSION "6.26.0")
option(WITH_X11_SESSION "Build and install X11 session (deprecated)" ON)
option(INSTALL_SDDM_WAYLAND_SESSION OFF)
option(WITH_X11 "Build with X11 support. Building without is experimental" ON)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMMarkNonGuiExecutable)
include(CMakePackageConfigHelpers)
include(WriteBasicConfigVersionFile)
include(CheckIncludeFiles)
include(FeatureSummary)
include(ECMOptionalAddSubdirectory)
include(ECMQtDeclareLoggingCategory)
include(ECMQueryQt)
include(ECMInstallIcons)
include(KDEClangFormat)
include(KDEGitCommitHooks)
include(ECMConfiguredInstall)
include(ECMGenerateDBusServiceFile)
include(ECMFindQmlModule)
include(ECMGenerateExportHeader)
include(ECMDeprecationSettings)
include(ECMQmlModule)
find_package(PkgConfig REQUIRED)
pkg_check_modules(Flatpak IMPORTED_TARGET flatpak>=0.11.8)
pkg_check_modules(PipeWire QUIET IMPORTED_TARGET libpipewire-0.3)
add_feature_info(PipeWire PipeWire_FOUND "Required for camera indicator applet and Wayland screencasting testing")
set(BUILD_CAMERAINDICATOR_DEFAULT OFF)
if(PipeWire_FOUND)
set(BUILD_CAMERAINDICATOR_DEFAULT ON)
endif()
option(BUILD_CAMERAINDICATOR "Build the camera indicator Plasma applet" ${BUILD_CAMERAINDICATOR_DEFAULT})
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Concurrent DBus Location Network Positioning Quick QuickWidgets
ShaderTools Sql Svg Widgets)
if (Qt6Gui_VERSION VERSION_GREATER_EQUAL "6.10.0")
find_package(Qt6GuiPrivate ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
find_package(Qt6WaylandClientPrivate ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
endif()
find_package(QCoro6 REQUIRED COMPONENTS Core)
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
Archive Auth CoreAddons Crash DBusAddons Declarative GlobalAccel GuiAddons
Holidays I18n IconThemes IdleTime ItemModels KCMUtils KDED KIO NewStuff
Notifications Package Parts Prison Runner StatusNotifierItem
Svg TextEditor TextWidgets Wallet ColorScheme
OPTIONAL_COMPONENTS DocTools)
find_package(Plasma ${PROJECT_DEP_VERSION} REQUIRED)
find_package(PlasmaQuick ${PROJECT_DEP_VERSION} REQUIRED)
find_package(KWayland ${PROJECT_DEP_VERSION} REQUIRED)
find_package(PlasmaActivities ${PROJECT_DEP_VERSION} REQUIRED)
find_package(PlasmaActivitiesStats ${PROJECT_DEP_VERSION} REQUIRED)
find_package(KSysGuard ${PROJECT_DEP_VERSION} CONFIG)
set_package_properties(KSysGuard PROPERTIES
DESCRIPTION "Components to monitor the system"
TYPE REQUIRED
)
find_package(KF6Screen ${PROJECT_DEP_VERSION} CONFIG REQUIRED)
find_package(LayerShellQt ${PROJECT_DEP_VERSION} CONFIG REQUIRED)
if (BUILD_TESTING)
include(ECMAddTests)
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Test QuickTest)
find_package(Qt6 REQUIRED CONFIG COMPONENTS WaylandCompositor)
endif()
find_package(KF6Kirigami ${KF6_MIN_VERSION} CONFIG)
set_package_properties(KF6Kirigami PROPERTIES
DESCRIPTION "A QtQuick based components set"
TYPE RUNTIME
)
find_package(KF6KirigamiAddons 0.10.0 CONFIG)
set_package_properties(KF6KirigamiAddons PROPERTIES
DESCRIPTION "Extra controls for Kirigami applications"
PURPOSE "Required at runtime for the User KCM"
TYPE RUNTIME
)
# there's no NetworkManager on FreeBSD'
if (LINUX)
find_package(KF6NetworkManagerQt ${KF6_MIN_VERSION} CONFIG REQUIRED)
endif()
find_package(KF6QuickCharts ${KF6_MIN_VERSION} CONFIG)
set_package_properties(KF6QuickCharts PROPERTIES
DESCRIPTION "Used for rendering charts"
TYPE RUNTIME
)
find_package(KF6UserFeedback)
find_package(KF6Baloo)
set_package_properties(KF6Baloo PROPERTIES DESCRIPTION "File Searching"
TYPE RECOMMENDED
PURPOSE "Needed for the File Search runner."
)
pkg_check_modules(QALCULATE libqalculate>2.0 IMPORTED_TARGET)
set_package_properties(QALCULATE PROPERTIES
DESCRIPTION "A library for calculations, used in runners/calculator"
TYPE REQUIRED)
pkg_check_modules(DBus dbus-1 REQUIRED IMPORTED_TARGET)
find_package(KWinDBusInterface CONFIG REQUIRED)
find_package(ScreenSaverDBusInterface CONFIG REQUIRED)
# Used in kcm_autostart
pkg_check_modules(SYSTEMD "systemd")
find_package(Canberra)
set_package_properties(Canberra PROPERTIES
PURPOSE "Needed to preview notification sounds"
TYPE REQUIRED)
find_package(Breeze ${PROJECT_DEP_VERSION} CONFIG)
set_package_properties(Breeze PROPERTIES
TYPE OPTIONAL
PURPOSE "For setting the default window decoration plugin")
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES DESCRIPTION "Support for gzip compressed files and data streams"
URL "https://www.zlib.net"
TYPE REQUIRED
)
find_package(Freetype)
set_package_properties(Freetype PROPERTIES DESCRIPTION "Software library to render fonts"
URL "https://freetype.org"
TYPE OPTIONAL
)
find_package(Fontconfig)
set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configuration library"
URL "https://www.freedesktop.org/wiki/Software/fontconfig"
TYPE OPTIONAL
PURPOSE "Needed to build font configuration and installation tools"
)
find_package(PackageKitQt6)
set_package_properties(PackageKitQt6
PROPERTIES DESCRIPTION "Software Manager integration"
TYPE OPTIONAL
PURPOSE "Used to install additional language packages on demand and integrate for offline updates"
)
option(PACKAGEKIT_OFFLINE_UPDATES "Integrate with PackageKit for offline updates" OFF)
add_feature_info(PACKAGEKIT_OFFLINE_UPDATES PackageKitQt6_FOUND "Integrate with PackageKit for offline updates")
set(PACKAGEKIT_OFFLINE_UPDATES ${PackageKitQt6_FOUND})
if(WITH_X11_SESSION)
set(WITH_X11 1)
endif()
if(WITH_X11)
find_package(X11)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
URL "https://www.x.org"
TYPE REQUIRED
PURPOSE "Required for building the X11 based workspace")
function(check_X11_lib _lib)
if (NOT TARGET X11::${_lib})
message(SEND_ERROR "Required component ${_lib} of X11 was not found")
endif()
endfunction()
check_X11_lib(ICE)
check_X11_lib(SM)
check_X11_lib(X11)
check_X11_lib(Xau)
check_X11_lib(Xcursor)
check_X11_lib(Xfixes)
check_X11_lib(Xft)
check_X11_lib(Xrender)
check_X11_lib(Xtst)
set(HAVE_X11 1)
set(HAVE_XCURSOR 1)
set(HAVE_XFIXES 1)
find_package(XCB MODULE REQUIRED COMPONENTS AUX XCB CURSOR RANDR IMAGE)
set_package_properties(XCB PROPERTIES TYPE REQUIRED)
find_package(KScreenLocker ${PROJECT_DEP_VERSION} REQUIRED)
else()
set(HAVE_X11 0)
set(HAVE_XCURSOR 0)
set(HAVE_XFIXES 0)
endif()
# FreeBSD systems might have libxcrypt but their shadow equivalent doesn't use it
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
pkg_check_modules(libxcrypt libxcrypt>=4)
if(libxcrypt_FOUND)
set(HAVE_CRYPT_GENSALT true)
endif()
endif()
find_package(Qt6WaylandClient COMPONENTS Private)
find_package(PlasmaWaylandProtocols 1.21.0 REQUIRED)
find_package(Wayland REQUIRED COMPONENTS Client Server) # Server is used in autotests
if(FONTCONFIG_FOUND)
# kfontinst
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS PrintSupport)
endif()
find_package(AppStreamQt 1.0) # 1.0 will be the first release to support Qt6
set_package_properties(AppStreamQt PROPERTIES DESCRIPTION "Access metadata for listing available software"
URL "https://www.freedesktop.org/wiki/Distributions/AppStream/"
TYPE OPTIONAL)
if(AppStreamQt_FOUND)
set(HAVE_APPSTREAMQT true)
endif()
find_package(UDev REQUIRED)
set_package_properties(UDev PROPERTIES
PURPOSE "Allows to play notification sounds when (un)plugging devices"
TYPE REQUIRED
)
# Region & Language KCM
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# notes for packager:
# This is the macro definition part of Region & Language KCM
# Depending on your distributions, the KCM behaves differently
# For Ubuntu based systems, this KCM uses "check-language-support" and PackageKit
# to install relevant fonts and packages
# You should enable option UBUNTU_PACKAGEKIT (it's auto detected though)
#
# For Glibc systems that don't come with pre-generated locales, such as ArchLinux
# This KCM uses "/etc/locale.gen" and "locale-gen" to generate configured locales
# and display a note to let user install fonts themselves if required
# You shouldn't required to do anything in this case
#
# For Glibc systems that come with pre-generated locales, such as Fedora and openSUSE
# a note to let user install fonts themselves if required is displayed
# You should enable GLIBC_LOCALE_PREGENERATED option
#
# For non-glibc systems such as VoidLinux and *BSD
# A warning of configure locale manually is displayed (although the relevant ENVs are set by Plasma)
# You should disable GLIBC_LOCALE_GEN option
# find out if the build system is Ubuntu based
if (${CMAKE_VERSION} VERSION_LESS 3.22)
find_program(LSB_RELEASE_EXEC lsb_release)
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
OUTPUT_VARIABLE DISTRO_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(TOLOWER "${DISTRO_NAME}" DISTRO_NAME)
else()
cmake_host_system_information(RESULT DISTRO_NAME QUERY DISTRIB_ID)
cmake_host_system_information(RESULT DISTRO_ID_LIKE QUERY DISTRIB_ID_LIKE)
endif()
string(COMPARE EQUAL "ubuntu" "${DISTRO_NAME}" SYSTEM_UBUNTU_BASED)
string(FIND "${DISTRO_ID_LIKE}" "ubuntu" FINDINDEX)
if(NOT (FINDINDEX EQUAL -1))
set(SYSTEM_UBUNTU_BASED ON)
find_program(LANGUAGE_SELECTOR_COMMON "check-language-support" DOC "Required for ubuntu-based distros to generate locale")
endif()
set(UBUNTU_LOCALE FALSE)
option(UBUNTU_PACKAGEKIT "Install required package for language on Ubuntu Based systems, PackageKitQt6 required" ${SYSTEM_UBUNTU_BASED})
if(UBUNTU_PACKAGEKIT)
set(UBUNTU_LOCALE ${PackageKitQt6_FOUND})
endif()
set(GLIBC_LOCALE_GEN_DEFAULT ON)
if(UBUNTU_LOCALE)
set(GLIBC_LOCALE_GEN_DEFAULT OFF)
endif()
option(GLIBC_LOCALE_GEN "Auto generate Glibc locale with locale-gen and /etc/locale.gen" ${GLIBC_LOCALE_GEN_DEFAULT})
if(GLIBC_LOCALE_GEN AND UBUNTU_LOCALE)
message(FATAL_ERROR "UBUNTU_PACKAGEKIT and GLIBC_LOCALE_GEN both enabled, only UBUNTU_PACKEGKIT will be used")
endif()
if(GLIBC_LOCALE_GEN)
set(GLIBC_LOCALE_AUTO TRUE)
endif()
set(REGION_LANG_GENERATE_LOCALE_HELPER FALSE)
if(UBUNTU_LOCALE OR GLIBC_LOCALE_GEN)
set(REGION_LANG_GENERATE_LOCALE_HELPER TRUE)
endif()
option(GLIBC_LOCALE_PREGENERATED "Systems that don't require locale generation. Such as openSUSE or Fedora" OFF)
if(GLIBC_LOCALE_PREGENERATED)
set(GLIBC_LOCALE_GENERATED TRUE)
endif()
if(REGION_LANG_GENERATE_LOCALE_HELPER AND GLIBC_LOCALE_PREGENERATED)
message(FATAL_ERROR "(UBUNTU_PACKAGEKIT || GLIBC_LOCALE_GEN) and GLIBC_LOCALE_PREGENERATED both enabled")
endif()
option(GLIBC_LOCALE "Build with glibc-compatible locale infrastructure" ON)
add_feature_info(GLIBC_LOCALE GLIBC_LOCALE "Locale support is glibc based")
add_feature_info(UBUNTU_LOCALE UBUNTU_LOCALE "Install language packages on Ubuntu-like systems")
add_feature_info(GLIBC_LOCALE_GEN GLIBC_LOCALE_GEN "Generate glibc locales")
add_feature_info(GLIBC_LOCALE_PREGENERATED GLIBC_LOCALE_PREGENERATED "glibc locales are pregenerated")
################## Find libraries ###################
if(REGION_LANG_GENERATE_LOCALE_HELPER)
find_package(PolkitQt6-1)
set_package_properties(PolkitQt6-1
PROPERTIES DESCRIPTION "DBus interface wrapper for Polkit"
PURPOSE "Communicate with localegen helper in region & lang kcm"
TYPE REQUIRED
)
endif()
endif()
find_package(ICU COMPONENTS i18n uc)
set_package_properties(ICU
PROPERTIES DESCRIPTION "Unicode and Globalization support for software applications"
TYPE REQUIRED
PURPOSE "Better application groups in Kicker, timezone support"
)
if(ICU_FOUND)
set(HAVE_ICU TRUE)
endif()
find_package(KExiv2Qt6)
set_package_properties(KExiv2Qt6
PROPERTIES URL "https://commits.kde.org/libkexiv2"
DESCRIPTION "Image metadata support"
TYPE OPTIONAL
PURPOSE "Provides metadata for image wallpaper plugin"
)
if(KExiv2Qt6_FOUND)
set(HAVE_KExiv2 TRUE)
endif()
find_package(KIOExtras)
set_package_properties(KIOExtras PROPERTIES DESCRIPTION "Common KIO slaves for operations."
PURPOSE "Show thumbnails in wallpaper selection."
TYPE RUNTIME
)
find_package(KIOFuse)
set_package_properties(KIOFuse PROPERTIES DESCRIPTION "Provide KIO support to legacy applications. "
TYPE RUNTIME
)
find_package(KNightTime ${PROJECT_DEP_VERSION} CONFIG REQUIRED)
# Clipboard applet
ecm_find_qmlmodule(org.kde.prison 1.0)
# Is building in KDE CI
if(DEFINED ENV{KDECI_BUILD})
set(KDECI_BUILD true)
endif()
include(ConfigureChecks.cmake)
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
ecm_set_disabled_deprecation_versions(
QT 5.15.2
KF 5.98.0
)
configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h)
configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h)
configure_file(config-appstream.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-appstream.h )
configure_file(config-KDECI_BUILD.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-KDECI_BUILD.h )
add_subdirectory(login-sessions)
add_subdirectory(lookandfeel)
if (INSTALL_SDDM_WAYLAND_SESSION)
install(FILES sddm-wayland-session/plasma-wayland.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/sddm/sddm.conf.d)
else()
message(STATUS "INSTALL_SDDM_WAYLAND_SESSION is disabled. As soon as it's installed, SDDM will default to use Wayland and KWin for its greeter session (BETA, do not deploy to final users yet).")
endif()
install(FILES portal-configuration/kde-portals.conf DESTINATION ${KDE_INSTALL_DATADIR}/xdg-desktop-portal)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
# locate qdbus in the Qt path because not every distro makes a symlink at /usr/bin/qdbus
ecm_query_qt(QtBinariesDir QT_INSTALL_BINS)
if(KF6DocTools_FOUND)
add_subdirectory(doc)
kdoctools_install(po)
endif()
add_subdirectory(libklookandfeel)
add_subdirectory(libkworkspace)
add_subdirectory(libdbusmenuqt)
add_subdirectory(appmenu)
add_subdirectory(oom_notifier)
add_subdirectory(libclock)
add_subdirectory(libtaskmanager)
add_subdirectory(libkmpris)
add_subdirectory(libnotificationmanager)
add_subdirectory(components)
add_subdirectory(plasma-windowed)
add_subdirectory(shell)
add_subdirectory(freespacenotifier)
add_subdirectory(klipper)
add_subdirectory(krunner)
if(WITH_X11)
add_subdirectory(ksmserver)
endif()
add_subdirectory(logout-greeter)
add_subdirectory(ksplash)
add_subdirectory(statusnotifierwatcher)
add_subdirectory(startkde)
add_subdirectory(themes)
add_subdirectory(kcms)
add_subdirectory(containmentactions)
add_subdirectory(runners)
add_subdirectory(applets)
add_subdirectory(wallpapers)
add_subdirectory(kioworkers)
add_subdirectory(ktimezoned)
if(TARGET KF6::NetworkManagerQt)
add_subdirectory(geotimezoned)
endif()
add_subdirectory(menu)
add_subdirectory(donationmessage)
add_subdirectory(interactiveconsole)
# This ensures pressing the eject button on a CD drive ejects the disc
# It listens to the Solid::OpticalDrive::ejectPressed signal that is only
# supported by Solid in the HAL backend and does nothing with UDev
if(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
add_subdirectory(solidautoeject)
endif()
ecm_optional_add_subdirectory(xembed-sni-proxy)
if (WITH_X11)
#TODO port away from X11
ecm_optional_add_subdirectory(gmenu-dbusmenu-proxy)
endif()
add_subdirectory(soliduiserver)
add_subdirectory(plasmacalendarintegration)
add_subdirectory(appiumtests)
add_subdirectory(devicenotifications)
add_subdirectory(ksecretprompter)
ki18n_install(po)
install(FILES completions/plasmashell.zsh RENAME _plasmashell DESTINATION ${KDE_INSTALL_ZSHAUTOCOMPLETEDIR})
ecm_qt_install_logging_categories(
EXPORT PLASMAWORKSPACE
FILE plasma-workspace.categories
DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
@@ -0,0 +1,6 @@
set(KWIN_BIN "kwin_x11" CACHE STRING "Name of the KWin binary")
check_include_files(sys/time.h HAVE_SYS_TIME_H) # ksmserver, ksplashml, sftp
check_include_files(unistd.h HAVE_UNISTD_H)
set(HAVE_FONTCONFIG ${FONTCONFIG_FOUND}) # kcms/{fonts,kfontinst}
@@ -0,0 +1,4 @@
#! /bin/sh
#This file outputs in a separate line each file with a .desktop syntax
#that needs to be translated but has a non .desktop extension
find -name \*.kdevtemplate -print
@@ -0,0 +1,20 @@
Understanding the Code
======================
API documentation generated from the headers is hosted at https://api.kde.org.
Finding the Team
================
You can find the Plasma team on:
* our development mailing list at plasma-devel@kde.org
* our irc channel in #plasma on irc.libera.chat
Coding Style
============
New code should follow the kdelibs hacking style, as found here:
https://community.kde.org/Policies/Frameworks_Coding_Style
Existing code that does not follow this style should be migrated over during
editing.
@@ -0,0 +1,22 @@
Copyright (c) <year> <owner> All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,26 @@
Copyright (c) <year> <owner>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
@@ -0,0 +1,311 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to
most of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software
is covered by the GNU Lesser General Public License instead.) You can apply
it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must give the recipients all the rights that you have. You
must make sure that they, too, receive or can get the source code. And you
must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If
the software is modified by someone else and passed on, we want its recipients
to know that what they have is not the original, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will individually
obtain patent licenses, in effect making the program proprietary. To prevent
this, we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
of this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or translated
into another language. (Hereinafter, translation is included without limitation
in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running the Program
is not restricted, and the output from the Program is covered only if its
contents constitute a work based on the Program (independent of having been
made by running the Program). Whether that is true depends on what the Program
does.
1. You may copy and distribute verbatim copies of the Program's source code
as you receive it, in any medium, provided that you conspicuously and appropriately
publish on each copy an appropriate copyright notice and disclaimer of warranty;
keep intact all the notices that refer to this License and to the absence
of any warranty; and give any other recipients of the Program a copy of this
License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it,
thus forming a work based on the Program, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) You must cause the modified files to carry prominent notices stating that
you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of this
License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the most
ordinary way, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying that
you provide a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this License.
(Exception: if the Program itself is interactive but does not normally print
such an announcement, your work based on the Program is not required to print
an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Program, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Program.
In addition, mere aggregation of another work not based on the Program with
the Program (or with a work based on the Program) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under Section
2) in object code or executable form under the terms of Sections 1 and 2 above
provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code,
which must be distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give
any third party, for a charge no more than your cost of physically performing
source distribution, a complete machine-readable copy of the corresponding
source code, to be distributed under the terms of Sections 1 and 2 above on
a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable
form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all
the source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and installation
of the executable. However, as a special exception, the source code distributed
need not include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component itself
accompanies the executable.
If distribution of executable or object code is made by offering access to
copy from a designated place, then offering equivalent access to copy the
source code from the same place counts as distribution of the source code,
even though third parties are not compelled to copy the source along with
the object code.
4. You may not copy, modify, sublicense, or distribute the Program except
as expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automatically terminate
your rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses terminated
so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Program or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Program
(or any work based on the Program), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor
to copy, distribute or modify the Program subject to these terms and conditions.
You may not impose any further restrictions on the recipients' exercise of
the rights granted herein. You are not responsible for enforcing compliance
by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of
this License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Program at all. For example, if a
patent license would not permit royalty-free redistribution of the Program
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system, which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Program under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of
the General Public License from time to time. Such new versions will be similar
in spirit to the present version, but may differ in detail to address new
problems or concerns.
Each version is given a distinguishing version number. If the Program specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Program does not specify a version number of this License, you may choose
any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software Foundation,
write to the Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing and reuse
of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively convey the exclusion
of warranty; and each file should have at least the "copyright" line and a
pointer to where the full notice is found.
one line to give the program's name and an idea of what it does. Copyright
(C) yyyy name of author
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how
to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when
it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
and you are welcome to redistribute it under certain conditions; type `show
c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than `show w' and `show c'; they could even be mouse-clicks
or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
(which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
@@ -0,0 +1,311 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to
most of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software
is covered by the GNU Lesser General Public License instead.) You can apply
it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must give the recipients all the rights that you have. You
must make sure that they, too, receive or can get the source code. And you
must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If
the software is modified by someone else and passed on, we want its recipients
to know that what they have is not the original, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will individually
obtain patent licenses, in effect making the program proprietary. To prevent
this, we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
of this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or translated
into another language. (Hereinafter, translation is included without limitation
in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running the Program
is not restricted, and the output from the Program is covered only if its
contents constitute a work based on the Program (independent of having been
made by running the Program). Whether that is true depends on what the Program
does.
1. You may copy and distribute verbatim copies of the Program's source code
as you receive it, in any medium, provided that you conspicuously and appropriately
publish on each copy an appropriate copyright notice and disclaimer of warranty;
keep intact all the notices that refer to this License and to the absence
of any warranty; and give any other recipients of the Program a copy of this
License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it,
thus forming a work based on the Program, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) You must cause the modified files to carry prominent notices stating that
you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of this
License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the most
ordinary way, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying that
you provide a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this License.
(Exception: if the Program itself is interactive but does not normally print
such an announcement, your work based on the Program is not required to print
an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Program, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Program.
In addition, mere aggregation of another work not based on the Program with
the Program (or with a work based on the Program) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under Section
2) in object code or executable form under the terms of Sections 1 and 2 above
provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code,
which must be distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give
any third party, for a charge no more than your cost of physically performing
source distribution, a complete machine-readable copy of the corresponding
source code, to be distributed under the terms of Sections 1 and 2 above on
a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable
form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all
the source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and installation
of the executable. However, as a special exception, the source code distributed
need not include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component itself
accompanies the executable.
If distribution of executable or object code is made by offering access to
copy from a designated place, then offering equivalent access to copy the
source code from the same place counts as distribution of the source code,
even though third parties are not compelled to copy the source along with
the object code.
4. You may not copy, modify, sublicense, or distribute the Program except
as expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automatically terminate
your rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses terminated
so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Program or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Program
(or any work based on the Program), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor
to copy, distribute or modify the Program subject to these terms and conditions.
You may not impose any further restrictions on the recipients' exercise of
the rights granted herein. You are not responsible for enforcing compliance
by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of
this License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Program at all. For example, if a
patent license would not permit royalty-free redistribution of the Program
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system, which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Program under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of
the General Public License from time to time. Such new versions will be similar
in spirit to the present version, but may differ in detail to address new
problems or concerns.
Each version is given a distinguishing version number. If the Program specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Program does not specify a version number of this License, you may choose
any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software Foundation,
write to the Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing and reuse
of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively convey the exclusion
of warranty; and each file should have at least the "copyright" line and a
pointer to where the full notice is found.
one line to give the program's name and an idea of what it does. Copyright
(C) yyyy name of author
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how
to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when
it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
and you are welcome to redistribute it under certain conditions; type `show
c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than `show w' and `show c'; they could even be mouse-clicks
or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
(which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
@@ -0,0 +1,604 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and
other kinds of works.
The licenses for most software and other practical works are designed to take
away your freedom to share and change the works. By contrast, the GNU General
Public License is intended to guarantee your freedom to share and change all
versions of a program--to make sure it remains free software for all its users.
We, the Free Software Foundation, use the GNU General Public License for most
of our software; it applies also to any other work released this way by its
authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for them if you wish), that
you receive source code or can get it if you want it, that you can change
the software or use pieces of it in new free programs, and that you know you
can do these things.
To protect your rights, we need to prevent others from denying you these rights
or asking you to surrender the rights. Therefore, you have certain responsibilities
if you distribute copies of the software, or if you modify it: responsibilities
to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must pass on to the recipients the same freedoms that you received.
You must make sure that they, too, receive or can get the source code. And
you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert
copyright on the software, and (2) offer you this License giving you legal
permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that
there is no warranty for this free software. For both users' and authors'
sake, the GPL requires that modified versions be marked as changed, so that
their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified
versions of the software inside them, although the manufacturer can do so.
This is fundamentally incompatible with the aim of protecting users' freedom
to change the software. The systematic pattern of such abuse occurs in the
area of products for individuals to use, which is precisely where it is most
unacceptable. Therefore, we have designed this version of the GPL to prohibit
the practice for those products. If such problems arise substantially in other
domains, we stand ready to extend this provision to those domains in future
versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States
should not allow patents to restrict development and use of software on general-purpose
computers, but in those that do, we wish to avoid the special danger that
patents applied to a free program could make it effectively proprietary. To
prevent this, the GPL assures that patents cannot be used to render the program
non-free.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works,
such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License.
Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals
or organizations.
To “modify” a work means to copy from or adapt all or part of the work in
a fashion requiring copyright permission, other than the making of an exact
copy. The resulting work is called a “modified version” of the earlier work
or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the
Program.
To “propagate” a work means to do anything with it that, without permission,
would make you directly or secondarily liable for infringement under applicable
copyright law, except executing it on a computer or modifying a private copy.
Propagation includes copying, distribution (with or without modification),
making available to the public, and in some countries other activities as
well.
To “convey” a work means any kind of propagation that enables other parties
to make or receive copies. Mere interaction with a user through a computer
network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the
extent that it includes a convenient and prominently visible feature that
(1) displays an appropriate copyright notice, and (2) tells the user that
there is no warranty for the work (except to the extent that warranties are
provided), that licensees may convey the work under this License, and how
to view a copy of this License. If the interface presents a list of user commands
or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making
modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard
defined by a recognized standards body, or, in the case of interfaces specified
for a particular programming language, one that is widely used among developers
working in that language.
The “System Libraries” of an executable work include anything, other than
the work as a whole, that (a) is included in the normal form of packaging
a Major Component, but which is not part of that Major Component, and (b)
serves only to enable use of the work with that Major Component, or to implement
a Standard Interface for which an implementation is available to the public
in source code form. A “Major Component”, in this context, means a major essential
component (kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to produce
the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source
code needed to generate, install, and (for an executable work) run the object
code and to modify the work, including scripts to control those activities.
However, it does not include the work's System Libraries, or general-purpose
tools or generally available free programs which are used unmodified in performing
those activities but which are not part of the work. For example, Corresponding
Source includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically linked
subprograms that the work is specifically designed to require, such as by
intimate data communication or control flow between those subprograms and
other parts of the work.
The Corresponding Source need not include anything that users can regenerate
automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright
on the Program, and are irrevocable provided the stated conditions are met.
This License explicitly affirms your unlimited permission to run the unmodified
Program. The output from running a covered work is covered by this License
only if the output, given its content, constitutes a covered work. This License
acknowledges your rights of fair use or other equivalent, as provided by copyright
law.
You may make, run and propagate covered works that you do not convey, without
conditions so long as your license otherwise remains in force. You may convey
covered works to others for the sole purpose of having them make modifications
exclusively for you, or provide you with facilities for running those works,
provided that you comply with the terms of this License in conveying all material
for which you do not control copyright. Those thus making or running the covered
works for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of your copyrighted
material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure
under any applicable law fulfilling obligations under article 11 of the WIPO
copyright treaty adopted on 20 December 1996, or similar laws prohibiting
or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention
of technological measures to the extent such circumvention is effected by
exercising rights under this License with respect to the covered work, and
you disclaim any intention to limit operation or modification of the work
as a means of enforcing, against the work's users, your or third parties'
legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive
it, in any medium, provided that you conspicuously and appropriately publish
on each copy an appropriate copyright notice; keep intact all notices stating
that this License and any non-permissive terms added in accord with section
7 apply to the code; keep intact all notices of the absence of any warranty;
and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you
may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce
it from the Program, in the form of source code under the terms of section
4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and
giving a relevant date.
b) The work must carry prominent notices stating that it is released under
this License and any conditions added under section 7. This requirement modifies
the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone
who comes into possession of a copy. This License will therefore apply, along
with any applicable section 7 additional terms, to the whole of the work,
and all its parts, regardless of how they are packaged. This License gives
no permission to license the work in any other way, but it does not invalidate
such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate
Legal Notices; however, if the Program has interactive interfaces that do
not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works,
which are not by their nature extensions of the covered work, and which are
not combined with it such as to form a larger program, in or on a volume of
a storage or distribution medium, is called an “aggregate” if the compilation
and its resulting copyright are not used to limit the access or legal rights
of the compilation's users beyond what the individual works permit. Inclusion
of a covered work in an aggregate does not cause this License to apply to
the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections
4 and 5, provided that you also convey the machine-readable Corresponding
Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including
a physical distribution medium), accompanied by the Corresponding Source fixed
on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including
a physical distribution medium), accompanied by a written offer, valid for
at least three years and valid for as long as you offer spare parts or customer
support for that product model, to give anyone who possesses the object code
either (1) a copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical medium customarily
used for software interchange, for a price no more than your reasonable cost
of physically performing this conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written
offer to provide the Corresponding Source. This alternative is allowed only
occasionally and noncommercially, and only if you received the object code
with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis
or for a charge), and offer equivalent access to the Corresponding Source
in the same way through the same place at no further charge. You need not
require recipients to copy the Corresponding Source along with the object
code. If the place to copy the object code is a network server, the Corresponding
Source may be on a different server (operated by you or a third party) that
supports equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source. Regardless
of what server hosts the Corresponding Source, you remain obligated to ensure
that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform
other peers where the object code and Corresponding Source of the work are
being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from
the Corresponding Source as a System Library, need not be included in conveying
the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible
personal property which is normally used for personal, family, or household
purposes, or (2) anything designed or sold for incorporation into a dwelling.
In determining whether a product is a consumer product, doubtful cases shall
be resolved in favor of coverage. For a particular product received by a particular
user, “normally used” refers to a typical or common use of that class of product,
regardless of the status of the particular user or of the way in which the
particular user actually uses, or expects or is expected to use, the product.
A product is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent the
only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures,
authorization keys, or other information required to install and execute modified
versions of a covered work in that User Product from a modified version of
its Corresponding Source. The information must suffice to ensure that the
continued functioning of the modified object code is in no case prevented
or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically
for use in, a User Product, and the conveying occurs as part of a transaction
in which the right of possession and use of the User Product is transferred
to the recipient in perpetuity or for a fixed term (regardless of how the
transaction is characterized), the Corresponding Source conveyed under this
section must be accompanied by the Installation Information. But this requirement
does not apply if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has been installed
in ROM).
The requirement to provide Installation Information does not include a requirement
to continue to provide support service, warranty, or updates for a work that
has been modified or installed by the recipient, or for the User Product in
which it has been modified or installed. Access to a network may be denied
when the modification itself materially and adversely affects the operation
of the network or violates the rules and protocols for communication across
the network.
Corresponding Source conveyed, and Installation Information provided, in accord
with this section must be in a format that is publicly documented (and with
an implementation available to the public in source code form), and must require
no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License
by making exceptions from one or more of its conditions. Additional permissions
that are applicable to the entire Program shall be treated as though they
were included in this License, to the extent that they are valid under applicable
law. If additional permissions apply only to part of the Program, that part
may be used separately under those permissions, but the entire Program remains
governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any
additional permissions from that copy, or from any part of it. (Additional
permissions may be written to require their own removal in certain cases when
you modify the work.) You may place additional permissions on material, added
by you to a covered work, for which you have or can give appropriate copyright
permission.
Notwithstanding any other provision of this License, for material you add
to a covered work, you may (if authorized by the copyright holders of that
material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of
sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author
attributions in that material or in the Appropriate Legal Notices displayed
by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring
that modified versions of such material be marked in reasonable ways as different
from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors
of the material; or
e) Declining to grant rights under trademark law for use of some trade names,
trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by
anyone who conveys the material (or modified versions of it) with contractual
assumptions of liability to the recipient, for any liability that these contractual
assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions”
within the meaning of section 10. If the Program as you received it, or any
part of it, contains a notice stating that it is governed by this License
along with a term that is a further restriction, you may remove that term.
If a license document contains a further restriction but permits relicensing
or conveying under this License, you may add to a covered work material governed
by the terms of that license document, provided that the further restriction
does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place,
in the relevant source files, a statement of the additional terms that apply
to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form
of a separately written license, or stated as exceptions; the above requirements
apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided
under this License. Any attempt otherwise to propagate or modify it is void,
and will automatically terminate your rights under this License (including
any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from
a particular copyright holder is reinstated (a) provisionally, unless and
until the copyright holder explicitly and finally terminates your license,
and (b) permanently, if the copyright holder fails to notify you of the violation
by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently
if the copyright holder notifies you of the violation by some reasonable means,
this is the first time you have received notice of violation of this License
(for any work) from that copyright holder, and you cure the violation prior
to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses
of parties who have received copies or rights from you under this License.
If your rights have been terminated and not permanently reinstated, you do
not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy
of the Program. Ancillary propagation of a covered work occurring solely as
a consequence of using peer-to-peer transmission to receive a copy likewise
does not require acceptance. However, nothing other than this License grants
you permission to propagate or modify any covered work. These actions infringe
copyright if you do not accept this License. Therefore, by modifying or propagating
a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives
a license from the original licensors, to run, modify and propagate that work,
subject to this License. You are not responsible for enforcing compliance
by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization,
or substantially all assets of one, or subdividing an organization, or merging
organizations. If propagation of a covered work results from an entity transaction,
each party to that transaction who receives a copy of the work also receives
whatever licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the Corresponding
Source of the work from the predecessor in interest, if the predecessor has
it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights
granted or affirmed under this License. For example, you may not impose a
license fee, royalty, or other charge for exercise of rights granted under
this License, and you may not initiate litigation (including a cross-claim
or counterclaim in a lawsuit) alleging that any patent claim is infringed
by making, using, selling, offering for sale, or importing the Program or
any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License
of the Program or a work on which the Program is based. The work thus licensed
is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled
by the contributor, whether already acquired or hereafter acquired, that would
be infringed by some manner, permitted by this License, of making, using,
or selling its contributor version, but do not include claims that would be
infringed only as a consequence of further modification of the contributor
version. For purposes of this definition, “control” includes the right to
grant patent sublicenses in a manner consistent with the requirements of this
License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
license under the contributor's essential patent claims, to make, use, sell,
offer for sale, import and otherwise run, modify and propagate the contents
of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement
or commitment, however denominated, not to enforce a patent (such as an express
permission to practice a patent or covenant not to sue for patent infringement).
To “grant” such a patent license to a party means to make such an agreement
or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the
Corresponding Source of the work is not available for anyone to copy, free
of charge and under the terms of this License, through a publicly available
network server or other readily accessible means, then you must either (1)
cause the Corresponding Source to be so available, or (2) arrange to deprive
yourself of the benefit of the patent license for this particular work, or
(3) arrange, in a manner consistent with the requirements of this License,
to extend the patent license to downstream recipients. “Knowingly relying”
means you have actual knowledge that, but for the patent license, your conveying
the covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that country
that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement,
you convey, or propagate by procuring conveyance of, a covered work, and grant
a patent license to some of the parties receiving the covered work authorizing
them to use, propagate, modify or convey a specific copy of the covered work,
then the patent license you grant is automatically extended to all recipients
of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope
of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
of one or more of the rights that are specifically granted under this License.
You may not convey a covered work if you are a party to an arrangement with
a third party that is in the business of distributing software, under which
you make payment to the third party based on the extent of your activity of
conveying the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by you
(or copies made from those copies), or (b) primarily for and in connection
with specific products or compilations that contain the covered work, unless
you entered into that arrangement, or that patent license was granted, prior
to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied
license or other defenses to infringement that may otherwise be available
to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise)
that contradict the conditions of this License, they do not excuse you from
the conditions of this License. If you cannot convey a covered work so as
to satisfy simultaneously your obligations under this License and any other
pertinent obligations, then as a consequence you may not convey it at all.
For example, if you agree to terms that obligate you to collect a royalty
for further conveying from those to whom you convey the Program, the only
way you could satisfy both those terms and this License would be to refrain
entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to
link or combine any covered work with a work licensed under version 3 of the
GNU Affero General Public License into a single combined work, and to convey
the resulting work. The terms of this License will continue to apply to the
part which is the covered work, but the special requirements of the GNU Affero
General Public License, section 13, concerning interaction through a network
will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the
GNU General Public License from time to time. Such new versions will be similar
in spirit to the present version, but may differ in detail to address new
problems or concerns.
Each version is given a distinguishing version number. If the Program specifies
that a certain numbered version of the GNU General Public License “or any
later version” applies to it, you have the option of following the terms and
conditions either of that numbered version or of any later version published
by the Free Software Foundation. If the Program does not specify a version
number of the GNU General Public License, you may choose any version ever
published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of
the GNU General Public License can be used, that proxy's public statement
of acceptance of a version permanently authorizes you to choose that version
for the Program.
Later license versions may give you additional or different permissions. However,
no additional obligations are imposed on any author or copyright holder as
a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO
USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot
be given local legal effect according to their terms, reviewing courts shall
apply local law that most closely approximates an absolute waiver of all civil
liability in connection with the Program, unless a warranty or assumption
of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively state the exclusion
of warranty; and each file should have at least the “copyright” line and a
pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like
this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain
conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands might
be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a “copyright disclaimer” for the program, if necessary. For
more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General Public
License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -0,0 +1,444 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
[This is the first released version of the library GPL. It is numbered 2
because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public Licenses are intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users.
This license, the Library General Public License, applies to some specially
designated Free Software Foundation software, and to any other libraries whose
authors decide to use it. You can use it for your libraries, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You must
make sure that they, too, receive or can get the source code. If you link
a program with the library, you must provide complete object files to the
recipients so that they can relink them with the library, after making changes
to the library and recompiling it. And you must show them these terms so they
know their rights.
Our method of protecting your rights has two steps: (1) copyright the library,
and (2) offer you this license which gives you legal permission to copy, distribute
and/or modify the library.
Also, for each distributor's protection, we want to make certain that everyone
understands that there is no warranty for this free library. If the library
is modified by someone else and passed on, we want its recipients to know
that what they have is not the original version, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that companies distributing free software will individually
obtain patent licenses, thus in effect transforming the program into proprietary
software. To prevent this, we have made it clear that any patent must be licensed
for everyone's free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License, which was designed for utility programs. This license,
the GNU Library General Public License, applies to certain designated libraries.
This license is quite different from the ordinary one; be sure to read it
in full, and don't assume that anything in it is the same as in the ordinary
license.
The reason we have a separate public license for some libraries is that they
blur the distinction we usually make between modifying or adding to a program
and simply using it. Linking a program with a library, without changing the
library, is in some sense simply using the library, and is analogous to running
a utility program or application program. However, in a textual and legal
sense, the linked executable is a combined work, a derivative of the original
library, and the ordinary General Public License treats it as such.
Because of this blurred distinction, using the ordinary General Public License
for libraries did not effectively promote software sharing, because most developers
did not use the libraries. We concluded that weaker conditions might promote
sharing better.
However, unrestricted linking of non-free programs would deprive the users
of those programs of all benefit from the free status of the libraries themselves.
This Library General Public License is intended to permit developers of non-free
programs to use free libraries, while preserving your freedom as a user of
such programs to change the free libraries that are incorporated in them.
(We have not seen how to achieve this as regards changes in header files,
but we have achieved it as regards changes in the actual functions of the
Library.) The hope is that this will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code derived
from the library, while the latter only works together with the library.
Note that it is possible for a library to be covered by the ordinary General
Public License rather than by this special one.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which contains a
notice placed by the copyright holder or other authorized party saying it
may be distributed under the terms of this Library General Public License
(also called "this License"). Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data prepared
so as to be conveniently linked with application programs (which use some
of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has
been distributed under these terms. A "work based on the Library" means either
the Library or any derivative work under copyright law: that is to say, a
work containing the Library or a portion of it, either verbatim or with modifications
and/or translated straightforwardly into another language. (Hereinafter, translation
is included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making modifications
to it. For a library, complete source code means all the source code for all
modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the library.
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running a program
using the Library is not restricted, and output from such a program is covered
only if its contents constitute a work based on the Library (independent of
the use of the Library in a tool for writing it). Whether that is true depends
on what the Library does and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and disclaimer
of warranty; keep intact all the notices that refer to this License and to
the absence of any warranty; and distribute a copy of this License along with
the Library.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating that
you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to all
third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table of
data to be supplied by an application program that uses the facility, other
than as an argument passed when the facility is invoked, then you must make
a good faith effort to ensure that, in the event an application does not supply
such function or table, the facility still operates, and performs whatever
part of its purpose remains meaningful.
(For example, a function in a library to compute square roots has a purpose
that is entirely well-defined independent of the application. Therefore, Subsection
2d requires that any application-supplied function or table used by this function
must be optional: if the application does not supply it, the square root function
must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Library, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Library.
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may opt to apply the terms of the ordinary GNU General Public License
instead of this License to a given copy of the Library. To do this, you must
alter all the notices that refer to this License, so that they refer to the
ordinary GNU General Public License, version 2, instead of to this License.
(If a newer version than version 2 of the ordinary GNU General Public License
has appeared, then you can specify that version instead if you wish.) Do not
make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy,
so the ordinary GNU General Public License applies to all subsequent copies
and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library
into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you accompany it with the complete corresponding
machine-readable source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated
place, then offering equivalent access to copy the source code from the same
place satisfies the requirement to distribute the source code, even though
third parties are not compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with it,
is called a "work that uses the Library". Such a work, in isolation, is not
a derivative work of the Library, and therefore falls outside the scope of
this License.
However, linking a "work that uses the Library" with the Library creates an
executable that is a derivative of the Library (because it contains portions
of the Library), rather than a "work that uses the library". The executable
is therefore covered by this License. Section 6 states terms for distribution
of such executables.
When a "work that uses the Library" uses material from a header file that
is part of the Library, the object code for the work may be a derivative work
of the Library even though the source code is not. Whether this is true is
especially significant if the work can be linked without the Library, or if
the work is itself a library. The threshold for this to be true is not precisely
defined by law.
If such an object file uses only numerical parameters, data structure layouts
and accessors, and small macros and small inline functions (ten lines or less
in length), then the use of the object file is unrestricted, regardless of
whether it is legally a derivative work. (Executables containing this object
code plus portions of the Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute
the object code for the work under the terms of Section 6. Any executables
containing that work also fall under Section 6, whether or not they are linked
directly with the Library itself.
6. As an exception to the Sections above, you may also compile or link a "work
that uses the Library" with the Library to produce a work containing portions
of the Library, and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the customer's own use
and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library
is used in it and that the Library and its use are covered by this License.
You must supply a copy of this License. If the work during execution displays
copyright notices, you must include the copyright notice for the Library among
them, as well as a reference directing the user to the copy of this License.
Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable source
code for the Library including whatever changes were used in the work (which
must be distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete machine-readable "work
that uses the Library", as object code and/or source code, so that the user
can modify the Library and then relink to produce a modified executable containing
the modified Library. (It is understood that the user who changes the contents
of definitions files in the Library will not necessarily be able to recompile
the application to use the modified definitions.)
b) Accompany the work with a written offer, valid for at least three years,
to give the same user the materials specified in Subsection 6a, above, for
a charge no more than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy from a designated
place, offer equivalent access to copy the above specified materials from
the same place.
d) Verify that the user has already received a copy of these materials or
that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library" must
include any data and utility programs needed for reproducing the executable
from it. However, as a special exception, the source code distributed need
not include anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the operating
system on which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license restrictions of
other proprietary libraries that do not normally accompany the operating system.
Such a contradiction means you cannot use both them and the Library together
in an executable that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side
in a single library together with other library facilities not covered by
this License, and distribute such a combined library, provided that the separate
distribution of the work based on the Library and of the other library facilities
is otherwise permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities. This must be distributed
under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part of
it is a work based on the Library, and explaining where to find the accompanying
uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library
except as expressly provided under this License. Any attempt otherwise to
copy, modify, sublicense, link with, or distribute the Library is void, and
will automatically terminate your rights under this License. However, parties
who have received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Library or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Library
(or any work based on the Library), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library),
the recipient automatically receives a license from the original licensor
to copy, distribute, link with or modify the Library subject to these terms
and conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties to this License.
11. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of
this License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Library at all. For example, if a
patent license would not permit royalty-free redistribution of the Library
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Library under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Library General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to address
new problems or concerns.
Each version is given a distinguishing version number. If the Library specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Library does not specify a license version number, you may choose any version
ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs
whose distribution conditions are incompatible with these, write to the author
to ask for permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest possible
use to the public, we recommend making it free software that everyone can
redistribute and change. You can do so by permitting redistribution under
these terms (or, alternatively, under the terms of the ordinary General Public
License).
To apply these terms, attach the following notices to the library. It is safest
to attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the "copyright"
line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for
more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
@@ -0,0 +1,444 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
[This is the first released version of the library GPL. It is numbered 2
because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public Licenses are intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users.
This license, the Library General Public License, applies to some specially
designated Free Software Foundation software, and to any other libraries whose
authors decide to use it. You can use it for your libraries, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You must
make sure that they, too, receive or can get the source code. If you link
a program with the library, you must provide complete object files to the
recipients so that they can relink them with the library, after making changes
to the library and recompiling it. And you must show them these terms so they
know their rights.
Our method of protecting your rights has two steps: (1) copyright the library,
and (2) offer you this license which gives you legal permission to copy, distribute
and/or modify the library.
Also, for each distributor's protection, we want to make certain that everyone
understands that there is no warranty for this free library. If the library
is modified by someone else and passed on, we want its recipients to know
that what they have is not the original version, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that companies distributing free software will individually
obtain patent licenses, thus in effect transforming the program into proprietary
software. To prevent this, we have made it clear that any patent must be licensed
for everyone's free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License, which was designed for utility programs. This license,
the GNU Library General Public License, applies to certain designated libraries.
This license is quite different from the ordinary one; be sure to read it
in full, and don't assume that anything in it is the same as in the ordinary
license.
The reason we have a separate public license for some libraries is that they
blur the distinction we usually make between modifying or adding to a program
and simply using it. Linking a program with a library, without changing the
library, is in some sense simply using the library, and is analogous to running
a utility program or application program. However, in a textual and legal
sense, the linked executable is a combined work, a derivative of the original
library, and the ordinary General Public License treats it as such.
Because of this blurred distinction, using the ordinary General Public License
for libraries did not effectively promote software sharing, because most developers
did not use the libraries. We concluded that weaker conditions might promote
sharing better.
However, unrestricted linking of non-free programs would deprive the users
of those programs of all benefit from the free status of the libraries themselves.
This Library General Public License is intended to permit developers of non-free
programs to use free libraries, while preserving your freedom as a user of
such programs to change the free libraries that are incorporated in them.
(We have not seen how to achieve this as regards changes in header files,
but we have achieved it as regards changes in the actual functions of the
Library.) The hope is that this will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code derived
from the library, while the latter only works together with the library.
Note that it is possible for a library to be covered by the ordinary General
Public License rather than by this special one.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which contains a
notice placed by the copyright holder or other authorized party saying it
may be distributed under the terms of this Library General Public License
(also called "this License"). Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data prepared
so as to be conveniently linked with application programs (which use some
of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has
been distributed under these terms. A "work based on the Library" means either
the Library or any derivative work under copyright law: that is to say, a
work containing the Library or a portion of it, either verbatim or with modifications
and/or translated straightforwardly into another language. (Hereinafter, translation
is included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making modifications
to it. For a library, complete source code means all the source code for all
modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the library.
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running a program
using the Library is not restricted, and output from such a program is covered
only if its contents constitute a work based on the Library (independent of
the use of the Library in a tool for writing it). Whether that is true depends
on what the Library does and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and disclaimer
of warranty; keep intact all the notices that refer to this License and to
the absence of any warranty; and distribute a copy of this License along with
the Library.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating that
you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to all
third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table of
data to be supplied by an application program that uses the facility, other
than as an argument passed when the facility is invoked, then you must make
a good faith effort to ensure that, in the event an application does not supply
such function or table, the facility still operates, and performs whatever
part of its purpose remains meaningful.
(For example, a function in a library to compute square roots has a purpose
that is entirely well-defined independent of the application. Therefore, Subsection
2d requires that any application-supplied function or table used by this function
must be optional: if the application does not supply it, the square root function
must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Library, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Library.
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may opt to apply the terms of the ordinary GNU General Public License
instead of this License to a given copy of the Library. To do this, you must
alter all the notices that refer to this License, so that they refer to the
ordinary GNU General Public License, version 2, instead of to this License.
(If a newer version than version 2 of the ordinary GNU General Public License
has appeared, then you can specify that version instead if you wish.) Do not
make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy,
so the ordinary GNU General Public License applies to all subsequent copies
and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library
into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you accompany it with the complete corresponding
machine-readable source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated
place, then offering equivalent access to copy the source code from the same
place satisfies the requirement to distribute the source code, even though
third parties are not compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with it,
is called a "work that uses the Library". Such a work, in isolation, is not
a derivative work of the Library, and therefore falls outside the scope of
this License.
However, linking a "work that uses the Library" with the Library creates an
executable that is a derivative of the Library (because it contains portions
of the Library), rather than a "work that uses the library". The executable
is therefore covered by this License. Section 6 states terms for distribution
of such executables.
When a "work that uses the Library" uses material from a header file that
is part of the Library, the object code for the work may be a derivative work
of the Library even though the source code is not. Whether this is true is
especially significant if the work can be linked without the Library, or if
the work is itself a library. The threshold for this to be true is not precisely
defined by law.
If such an object file uses only numerical parameters, data structure layouts
and accessors, and small macros and small inline functions (ten lines or less
in length), then the use of the object file is unrestricted, regardless of
whether it is legally a derivative work. (Executables containing this object
code plus portions of the Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute
the object code for the work under the terms of Section 6. Any executables
containing that work also fall under Section 6, whether or not they are linked
directly with the Library itself.
6. As an exception to the Sections above, you may also compile or link a "work
that uses the Library" with the Library to produce a work containing portions
of the Library, and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the customer's own use
and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library
is used in it and that the Library and its use are covered by this License.
You must supply a copy of this License. If the work during execution displays
copyright notices, you must include the copyright notice for the Library among
them, as well as a reference directing the user to the copy of this License.
Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable source
code for the Library including whatever changes were used in the work (which
must be distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete machine-readable "work
that uses the Library", as object code and/or source code, so that the user
can modify the Library and then relink to produce a modified executable containing
the modified Library. (It is understood that the user who changes the contents
of definitions files in the Library will not necessarily be able to recompile
the application to use the modified definitions.)
b) Accompany the work with a written offer, valid for at least three years,
to give the same user the materials specified in Subsection 6a, above, for
a charge no more than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy from a designated
place, offer equivalent access to copy the above specified materials from
the same place.
d) Verify that the user has already received a copy of these materials or
that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library" must
include any data and utility programs needed for reproducing the executable
from it. However, as a special exception, the source code distributed need
not include anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the operating
system on which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license restrictions of
other proprietary libraries that do not normally accompany the operating system.
Such a contradiction means you cannot use both them and the Library together
in an executable that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side
in a single library together with other library facilities not covered by
this License, and distribute such a combined library, provided that the separate
distribution of the work based on the Library and of the other library facilities
is otherwise permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities. This must be distributed
under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part of
it is a work based on the Library, and explaining where to find the accompanying
uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library
except as expressly provided under this License. Any attempt otherwise to
copy, modify, sublicense, link with, or distribute the Library is void, and
will automatically terminate your rights under this License. However, parties
who have received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Library or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Library
(or any work based on the Library), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library),
the recipient automatically receives a license from the original licensor
to copy, distribute, link with or modify the Library subject to these terms
and conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties to this License.
11. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of
this License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Library at all. For example, if a
patent license would not permit royalty-free redistribution of the Library
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Library under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Library General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to address
new problems or concerns.
Each version is given a distinguishing version number. If the Library specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Library does not specify a license version number, you may choose any version
ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs
whose distribution conditions are incompatible with these, write to the author
to ask for permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest possible
use to the public, we recommend making it free software that everyone can
redistribute and change. You can do so by permitting redistribution under
these terms (or, alternatively, under the terms of the ordinary General Public
License).
To apply these terms, attach the following notices to the library. It is safest
to attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the "copyright"
line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for
more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
@@ -0,0 +1,462 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts as
the successor of the GNU Library Public License, version 2, hence the version
number 2.1.]
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public Licenses are intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users.
This license, the Lesser General Public License, applies to some specially
designated software packages--typically libraries--of the Free Software Foundation
and other authors who decide to use it. You can use it too, but we suggest
you first think carefully about whether this license or the ordinary General
Public License is the better strategy to use in any particular case, based
on the explanations below.
When we speak of free software, we are referring to freedom of use, not price.
Our General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish); that you receive source code or can get it if you want it; that you
can change the software and use pieces of it in new free programs; and that
you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid distributors
to deny you these rights or to ask you to surrender these rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the library or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You must
make sure that they, too, receive or can get the source code. If you link
other code with the library, you must provide complete object files to the
recipients, so that they can relink them with the library after making changes
to the library and recompiling it. And you must show them these terms so they
know their rights.
We protect your rights with a two-step method: (1) we copyright the library,
and (2) we offer you this license, which gives you legal permission to copy,
distribute and/or modify the library.
To protect each distributor, we want to make it very clear that there is no
warranty for the free library. Also, if the library is modified by someone
else and passed on, the recipients should know that what they have is not
the original version, so that the original author's reputation will not be
affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any free
program. We wish to make sure that a company cannot effectively restrict the
users of a free program by obtaining a restrictive license from a patent holder.
Therefore, we insist that any patent license obtained for a version of the
library must be consistent with the full freedom of use specified in this
license.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License. This license, the GNU Lesser General Public License,
applies to certain designated libraries, and is quite different from the ordinary
General Public License. We use this license for certain libraries in order
to permit linking those libraries into non-free programs.
When a program is linked with a library, whether statically or using a shared
library, the combination of the two is legally speaking a combined work, a
derivative of the original library. The ordinary General Public License therefore
permits such linking only if the entire combination fits its criteria of freedom.
The Lesser General Public License permits more lax criteria for linking other
code with the library.
We call this license the "Lesser" General Public License because it does Less
to protect the user's freedom than the ordinary General Public License. It
also provides other free software developers Less of an advantage over competing
non-free programs. These disadvantages are the reason we use the ordinary
General Public License for many libraries. However, the Lesser license provides
advantages in certain special circumstances.
For example, on rare occasions, there may be a special need to encourage the
widest possible use of a certain library, so that it becomes a de-facto standard.
To achieve this, non-free programs must be allowed to use the library. A more
frequent case is that a free library does the same job as widely used non-free
libraries. In this case, there is little to gain by limiting the free library
to free software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free programs
enables a greater number of people to use a large body of free software. For
example, permission to use the GNU C Library in non-free programs enables
many more people to use the whole GNU operating system, as well as its variant,
the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users'
freedom, it does ensure that the user of a program that is linked with the
Library has the freedom and the wherewithal to run that program using a modified
version of the Library.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code derived
from the library, whereas the latter must be combined with the library in
order to run.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Lesser General
Public License (also called "this License"). Each licensee is addressed as
"you".
A "library" means a collection of software functions and/or data prepared
so as to be conveniently linked with application programs (which use some
of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has
been distributed under these terms. A "work based on the Library" means either
the Library or any derivative work under copyright law: that is to say, a
work containing the Library or a portion of it, either verbatim or with modifications
and/or translated straightforwardly into another language. (Hereinafter, translation
is included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making modifications
to it. For a library, complete source code means all the source code for all
modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the library.
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running a program
using the Library is not restricted, and output from such a program is covered
only if its contents constitute a work based on the Library (independent of
the use of the Library in a tool for writing it). Whether that is true depends
on what the Library does and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and disclaimer
of warranty; keep intact all the notices that refer to this License and to
the absence of any warranty; and distribute a copy of this License along with
the Library.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating that
you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to all
third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table of
data to be supplied by an application program that uses the facility, other
than as an argument passed when the facility is invoked, then you must make
a good faith effort to ensure that, in the event an application does not supply
such function or table, the facility still operates, and performs whatever
part of its purpose remains meaningful.
(For example, a function in a library to compute square roots has a purpose
that is entirely well-defined independent of the application. Therefore, Subsection
2d requires that any application-supplied function or table used by this function
must be optional: if the application does not supply it, the square root function
must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Library, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Library.
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may opt to apply the terms of the ordinary GNU General Public License
instead of this License to a given copy of the Library. To do this, you must
alter all the notices that refer to this License, so that they refer to the
ordinary GNU General Public License, version 2, instead of to this License.
(If a newer version than version 2 of the ordinary GNU General Public License
has appeared, then you can specify that version instead if you wish.) Do not
make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy,
so the ordinary GNU General Public License applies to all subsequent copies
and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library
into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you accompany it with the complete corresponding
machine-readable source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated
place, then offering equivalent access to copy the source code from the same
place satisfies the requirement to distribute the source code, even though
third parties are not compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with it,
is called a "work that uses the Library". Such a work, in isolation, is not
a derivative work of the Library, and therefore falls outside the scope of
this License.
However, linking a "work that uses the Library" with the Library creates an
executable that is a derivative of the Library (because it contains portions
of the Library), rather than a "work that uses the library". The executable
is therefore covered by this License. Section 6 states terms for distribution
of such executables.
When a "work that uses the Library" uses material from a header file that
is part of the Library, the object code for the work may be a derivative work
of the Library even though the source code is not. Whether this is true is
especially significant if the work can be linked without the Library, or if
the work is itself a library. The threshold for this to be true is not precisely
defined by law.
If such an object file uses only numerical parameters, data structure layouts
and accessors, and small macros and small inline functions (ten lines or less
in length), then the use of the object file is unrestricted, regardless of
whether it is legally a derivative work. (Executables containing this object
code plus portions of the Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute
the object code for the work under the terms of Section 6. Any executables
containing that work also fall under Section 6, whether or not they are linked
directly with the Library itself.
6. As an exception to the Sections above, you may also combine or link a "work
that uses the Library" with the Library to produce a work containing portions
of the Library, and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the customer's own use
and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library
is used in it and that the Library and its use are covered by this License.
You must supply a copy of this License. If the work during execution displays
copyright notices, you must include the copyright notice for the Library among
them, as well as a reference directing the user to the copy of this License.
Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable source
code for the Library including whatever changes were used in the work (which
must be distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete machine-readable "work
that uses the Library", as object code and/or source code, so that the user
can modify the Library and then relink to produce a modified executable containing
the modified Library. (It is understood that the user who changes the contents
of definitions files in the Library will not necessarily be able to recompile
the application to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the Library. A
suitable mechanism is one that (1) uses at run time a copy of the library
already present on the user's computer system, rather than copying library
functions into the executable, and (2) will operate properly with a modified
version of the library, if the user installs one, as long as the modified
version is interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least three years,
to give the same user the materials specified in Subsection 6a, above, for
a charge no more than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy from a designated
place, offer equivalent access to copy the above specified materials from
the same place.
e) Verify that the user has already received a copy of these materials or
that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library" must
include any data and utility programs needed for reproducing the executable
from it. However, as a special exception, the materials to be distributed
need not include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component itself
accompanies the executable.
It may happen that this requirement contradicts the license restrictions of
other proprietary libraries that do not normally accompany the operating system.
Such a contradiction means you cannot use both them and the Library together
in an executable that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side
in a single library together with other library facilities not covered by
this License, and distribute such a combined library, provided that the separate
distribution of the work based on the Library and of the other library facilities
is otherwise permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities. This must be distributed
under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part of
it is a work based on the Library, and explaining where to find the accompanying
uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library
except as expressly provided under this License. Any attempt otherwise to
copy, modify, sublicense, link with, or distribute the Library is void, and
will automatically terminate your rights under this License. However, parties
who have received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Library or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Library
(or any work based on the Library), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library),
the recipient automatically receives a license from the original licensor
to copy, distribute, link with or modify the Library subject to these terms
and conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties with this License.
11. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of
this License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Library at all. For example, if a
patent license would not permit royalty-free redistribution of the Library
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Library under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Lesser General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to address
new problems or concerns.
Each version is given a distinguishing version number. If the Library specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Library does not specify a license version number, you may choose any version
ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs
whose distribution conditions are incompatible with these, write to the author
to ask for permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest possible
use to the public, we recommend making it free software that everyone can
redistribute and change. You can do so by permitting redistribution under
these terms (or, alternatively, under the terms of the ordinary General Public
License).
To apply these terms, attach the following notices to the library. It is safest
to attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the "copyright"
line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information
on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
@@ -0,0 +1,462 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts as
the successor of the GNU Library Public License, version 2, hence the version
number 2.1.]
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public Licenses are intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users.
This license, the Lesser General Public License, applies to some specially
designated software packages--typically libraries--of the Free Software Foundation
and other authors who decide to use it. You can use it too, but we suggest
you first think carefully about whether this license or the ordinary General
Public License is the better strategy to use in any particular case, based
on the explanations below.
When we speak of free software, we are referring to freedom of use, not price.
Our General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish); that you receive source code or can get it if you want it; that you
can change the software and use pieces of it in new free programs; and that
you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid distributors
to deny you these rights or to ask you to surrender these rights. These restrictions
translate to certain responsibilities for you if you distribute copies of
the library or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You must
make sure that they, too, receive or can get the source code. If you link
other code with the library, you must provide complete object files to the
recipients, so that they can relink them with the library after making changes
to the library and recompiling it. And you must show them these terms so they
know their rights.
We protect your rights with a two-step method: (1) we copyright the library,
and (2) we offer you this license, which gives you legal permission to copy,
distribute and/or modify the library.
To protect each distributor, we want to make it very clear that there is no
warranty for the free library. Also, if the library is modified by someone
else and passed on, the recipients should know that what they have is not
the original version, so that the original author's reputation will not be
affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any free
program. We wish to make sure that a company cannot effectively restrict the
users of a free program by obtaining a restrictive license from a patent holder.
Therefore, we insist that any patent license obtained for a version of the
library must be consistent with the full freedom of use specified in this
license.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License. This license, the GNU Lesser General Public License,
applies to certain designated libraries, and is quite different from the ordinary
General Public License. We use this license for certain libraries in order
to permit linking those libraries into non-free programs.
When a program is linked with a library, whether statically or using a shared
library, the combination of the two is legally speaking a combined work, a
derivative of the original library. The ordinary General Public License therefore
permits such linking only if the entire combination fits its criteria of freedom.
The Lesser General Public License permits more lax criteria for linking other
code with the library.
We call this license the "Lesser" General Public License because it does Less
to protect the user's freedom than the ordinary General Public License. It
also provides other free software developers Less of an advantage over competing
non-free programs. These disadvantages are the reason we use the ordinary
General Public License for many libraries. However, the Lesser license provides
advantages in certain special circumstances.
For example, on rare occasions, there may be a special need to encourage the
widest possible use of a certain library, so that it becomes a de-facto standard.
To achieve this, non-free programs must be allowed to use the library. A more
frequent case is that a free library does the same job as widely used non-free
libraries. In this case, there is little to gain by limiting the free library
to free software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free programs
enables a greater number of people to use a large body of free software. For
example, permission to use the GNU C Library in non-free programs enables
many more people to use the whole GNU operating system, as well as its variant,
the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users'
freedom, it does ensure that the user of a program that is linked with the
Library has the freedom and the wherewithal to run that program using a modified
version of the Library.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code derived
from the library, whereas the latter must be combined with the library in
order to run.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Lesser General
Public License (also called "this License"). Each licensee is addressed as
"you".
A "library" means a collection of software functions and/or data prepared
so as to be conveniently linked with application programs (which use some
of those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has
been distributed under these terms. A "work based on the Library" means either
the Library or any derivative work under copyright law: that is to say, a
work containing the Library or a portion of it, either verbatim or with modifications
and/or translated straightforwardly into another language. (Hereinafter, translation
is included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for making modifications
to it. For a library, complete source code means all the source code for all
modules it contains, plus any associated interface definition files, plus
the scripts used to control compilation and installation of the library.
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running a program
using the Library is not restricted, and output from such a program is covered
only if its contents constitute a work based on the Library (independent of
the use of the Library in a tool for writing it). Whether that is true depends
on what the Library does and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's complete source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and disclaimer
of warranty; keep intact all the notices that refer to this License and to
the absence of any warranty; and distribute a copy of this License along with
the Library.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all
of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating that
you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to all
third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a table of
data to be supplied by an application program that uses the facility, other
than as an argument passed when the facility is invoked, then you must make
a good faith effort to ensure that, in the event an application does not supply
such function or table, the facility still operates, and performs whatever
part of its purpose remains meaningful.
(For example, a function in a library to compute square roots has a purpose
that is entirely well-defined independent of the application. Therefore, Subsection
2d requires that any application-supplied function or table used by this function
must be optional: if the application does not supply it, the square root function
must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be reasonably
considered independent and separate works in themselves, then this License,
and its terms, do not apply to those sections when you distribute them as
separate works. But when you distribute the same sections as part of a whole
which is a work based on the Library, the distribution of the whole must be
on the terms of this License, whose permissions for other licensees extend
to the entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works based
on the Library.
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may opt to apply the terms of the ordinary GNU General Public License
instead of this License to a given copy of the Library. To do this, you must
alter all the notices that refer to this License, so that they refer to the
ordinary GNU General Public License, version 2, instead of to this License.
(If a newer version than version 2 of the ordinary GNU General Public License
has appeared, then you can specify that version instead if you wish.) Do not
make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy,
so the ordinary GNU General Public License applies to all subsequent copies
and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library
into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you accompany it with the complete corresponding
machine-readable source code, which must be distributed under the terms of
Sections 1 and 2 above on a medium customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated
place, then offering equivalent access to copy the source code from the same
place satisfies the requirement to distribute the source code, even though
third parties are not compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with it,
is called a "work that uses the Library". Such a work, in isolation, is not
a derivative work of the Library, and therefore falls outside the scope of
this License.
However, linking a "work that uses the Library" with the Library creates an
executable that is a derivative of the Library (because it contains portions
of the Library), rather than a "work that uses the library". The executable
is therefore covered by this License. Section 6 states terms for distribution
of such executables.
When a "work that uses the Library" uses material from a header file that
is part of the Library, the object code for the work may be a derivative work
of the Library even though the source code is not. Whether this is true is
especially significant if the work can be linked without the Library, or if
the work is itself a library. The threshold for this to be true is not precisely
defined by law.
If such an object file uses only numerical parameters, data structure layouts
and accessors, and small macros and small inline functions (ten lines or less
in length), then the use of the object file is unrestricted, regardless of
whether it is legally a derivative work. (Executables containing this object
code plus portions of the Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute
the object code for the work under the terms of Section 6. Any executables
containing that work also fall under Section 6, whether or not they are linked
directly with the Library itself.
6. As an exception to the Sections above, you may also combine or link a "work
that uses the Library" with the Library to produce a work containing portions
of the Library, and distribute that work under terms of your choice, provided
that the terms permit modification of the work for the customer's own use
and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library
is used in it and that the Library and its use are covered by this License.
You must supply a copy of this License. If the work during execution displays
copyright notices, you must include the copyright notice for the Library among
them, as well as a reference directing the user to the copy of this License.
Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable source
code for the Library including whatever changes were used in the work (which
must be distributed under Sections 1 and 2 above); and, if the work is an
executable linked with the Library, with the complete machine-readable "work
that uses the Library", as object code and/or source code, so that the user
can modify the Library and then relink to produce a modified executable containing
the modified Library. (It is understood that the user who changes the contents
of definitions files in the Library will not necessarily be able to recompile
the application to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the Library. A
suitable mechanism is one that (1) uses at run time a copy of the library
already present on the user's computer system, rather than copying library
functions into the executable, and (2) will operate properly with a modified
version of the library, if the user installs one, as long as the modified
version is interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least three years,
to give the same user the materials specified in Subsection 6a, above, for
a charge no more than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy from a designated
place, offer equivalent access to copy the above specified materials from
the same place.
e) Verify that the user has already received a copy of these materials or
that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library" must
include any data and utility programs needed for reproducing the executable
from it. However, as a special exception, the materials to be distributed
need not include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component itself
accompanies the executable.
It may happen that this requirement contradicts the license restrictions of
other proprietary libraries that do not normally accompany the operating system.
Such a contradiction means you cannot use both them and the Library together
in an executable that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side
in a single library together with other library facilities not covered by
this License, and distribute such a combined library, provided that the separate
distribution of the work based on the Library and of the other library facilities
is otherwise permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities. This must be distributed
under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that part of
it is a work based on the Library, and explaining where to find the accompanying
uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library
except as expressly provided under this License. Any attempt otherwise to
copy, modify, sublicense, link with, or distribute the Library is void, and
will automatically terminate your rights under this License. However, parties
who have received copies, or rights, from you under this License will not
have their licenses terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Library or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the Library
(or any work based on the Library), you indicate your acceptance of this License
to do so, and all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library),
the recipient automatically receives a license from the original licensor
to copy, distribute, link with or modify the Library subject to these terms
and conditions. You may not impose any further restrictions on the recipients'
exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties with this License.
11. If, as a consequence of a court judgment or allegation of patent infringement
or for any other reason (not limited to patent issues), conditions are imposed
on you (whether by court order, agreement or otherwise) that contradict the
conditions of this License, they do not excuse you from the conditions of
this License. If you cannot distribute so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then as
a consequence you may not distribute the Library at all. For example, if a
patent license would not permit royalty-free redistribution of the Library
by all those who receive copies directly or indirectly through you, then the
only way you could satisfy both it and this License would be to refrain entirely
from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system which is implemented by public license practices.
Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose
that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original copyright
holder who places the Library under this License may add an explicit geographical
distribution limitation excluding those countries, so that distribution is
permitted only in or among countries not thus excluded. In such case, this
License incorporates the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Lesser General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to address
new problems or concerns.
Each version is given a distinguishing version number. If the Library specifies
a version number of this License which applies to it and "any later version",
you have the option of following the terms and conditions either of that version
or of any later version published by the Free Software Foundation. If the
Library does not specify a license version number, you may choose any version
ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs
whose distribution conditions are incompatible with these, write to the author
to ask for permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free
status of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest possible
use to the public, we recommend making it free software that everyone can
redistribute and change. You can do so by permitting redistribution under
these terms (or, alternatively, under the terms of the ordinary General Public
License).
To apply these terms, attach the following notices to the library. It is safest
to attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the "copyright"
line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information
on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
@@ -0,0 +1,144 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms
and conditions of version 3 of the GNU General Public License, supplemented
by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser General
Public License, and the "GNU GPL" refers to version 3 of the GNU General Public
License.
"The Library" refers to a covered work governed by this License, other than
an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided by the
Library, but which is not otherwise based on the Library. Defining a subclass
of a class defined by the Library is deemed a mode of using an interface provided
by the Library.
A "Combined Work" is a work produced by combining or linking an Application
with the Library. The particular version of the Library with which the Combined
Work was made is also called the "Linked Version".
The "Minimal Corresponding Source" for a Combined Work means the Corresponding
Source for the Combined Work, excluding any source code for portions of the
Combined Work that, considered in isolation, are based on the Application,
and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the object
code and/or source code for the Application, including any data and utility
programs needed for reproducing the Combined Work from the Application, but
excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without
being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility
refers to a function or data to be supplied by an Application that uses the
facility (other than as an argument passed when the facility is invoked),
then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure
that, in the event an Application does not supply the function or data, the
facility still operates, and performs whatever part of its purpose remains
meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License
applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header
file that is part of the Library. You may convey such object code under terms
of your choice, provided that, if the incorporated material is not limited
to numerical parameters, data structure layouts and accessors, or small macros,
inline functions and templates (ten or fewer lines in length), you do both
of the following:
a) Give prominent notice with each copy of the object code that the Library
is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together,
effectively do not restrict modification of the portions of the Library contained
in the Combined Work and reverse engineering for debugging such modifications,
if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library
is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during execution, include
the copyright notice for the Library among these notices, as well as a reference
directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License,
and the Corresponding Application Code in a form suitable for, and under terms
that permit, the user to recombine or relink the Application with a modified
version of the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library.
A suitable mechanism is one that (a) uses at run time a copy of the Library
already present on the user's computer system, and (b) will operate properly
with a modified version of the Library that is interface-compatible with the
Linked Version.
e) Provide Installation Information, but only if you would otherwise be required
to provide such information under section 6 of the GNU GPL, and only to the
extent that such information is necessary to install and execute a modified
version of the Combined Work produced by recombining or relinking the Application
with a modified version of the Linked Version. (If you use option 4d0, the
Installation Information must accompany the Minimal Corresponding Source and
Corresponding Application Code. If you use option 4d1, you must provide the
Installation Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side
by side in a single library together with other library facilities that are
not Applications and are not covered by this License, and convey such a combined
library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities, conveyed under the
terms of this License.
b) Give prominent notice with the combined library that part of it is a work
based on the Library, and explaining where to find the accompanying uncombined
form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the
GNU Lesser General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to address
new problems or concerns.
Each version is given a distinguishing version number. If the Library as you
received it specifies that a certain numbered version of the GNU Lesser General
Public License "or any later version" applies to it, you have the option of
following the terms and conditions either of that published version or of
any later version published by the Free Software Foundation. If the Library
as you received it does not specify a version number of the GNU Lesser General
Public License, you may choose any version of the GNU Lesser General Public
License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether
future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is permanent
authorization for you to choose that version for the Library.
@@ -0,0 +1,71 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License.
"The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version".
The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
@@ -0,0 +1,12 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3 of
the license or (at your option) at any later version that is
accepted by the membership of KDE e.V. (or its successor
approved by the membership of KDE e.V.), which shall act as a
proxy as defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -0,0 +1,12 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the license or (at your option) any later version
that is accepted by the membership of KDE e.V. (or its successor
approved by the membership of KDE e.V.), which shall act as a
proxy as defined in Section 6 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -0,0 +1,20 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
## Plasma Workspace
Plasma Workspace is used as the base for Plasma Desktop, Mobile, and Bigscreen.
It contains shared KCMs, applets as well as multiple libraries.
### TaskManager Library
The Task Manager provides various QAbstractListModel-based model for listing
Windows (TaskManager::AbstractWindowTasksModel), Startup tasks (TaskManager::StartupTasksModel) and Launcher
Job (TaskManager::LauncherTasksModel).
### Workspace Library
libkworkspace provides functions to allow you to interact with the
%KDE session manager (SessionManagement).
### Notification Manager Library
libnotificationmanager is responsible for listing notifications, closing them
and interacting with them in Plasma. This class provides a %Qt model for jobs:
NotificationManager::JobsModel. As well as a %Qt model for notifications and
jobs: NotificationManager::Notifications.
@@ -0,0 +1,22 @@
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
if(NOT BUILD_TESTING OR NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
return()
endif()
find_package(SeleniumWebDriverATSPI)
set_package_properties(SeleniumWebDriverATSPI PROPERTIES
DESCRIPTION "Server component for selenium tests using Linux accessibility infrastructure"
PURPOSE "Needed for GUI tests"
URL "https://invent.kde.org/sdk/selenium-webdriver-at-spi"
TYPE OPTIONAL
)
if(NOT SeleniumWebDriverATSPI_FOUND AND NOT DEFINED ENV{KDECI_BUILD})
return()
endif()
add_subdirectory(applets)
add_subdirectory(kcms)
add_subdirectory(krunner)
add_subdirectory(wallpapers)
@@ -0,0 +1,73 @@
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: BSD-3-Clause
add_test(
NAME analogclocktest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/analogclocktest.py --failfast
)
add_test(
NAME appmenutest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/appmenutest.py --failfast
)
set_tests_properties(appmenutest PROPERTIES ENVIRONMENT "CMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
add_test(
NAME calendartest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/calendartest.py --failfast
)
add_test(
NAME cameraindicatortest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/cameraindicatortest.py
)
set_tests_properties(cameraindicatortest PROPERTIES ENVIRONMENT "CMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
add_test(
NAME clipboardtest_basic
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/clipboardtest.py -k basic
)
add_test(
NAME clipboardtest_extended
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/clipboardtest.py -k extended
)
add_test(
NAME clipboarddeadlocktest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/clipboarddeadlocktest.py
)
set_tests_properties(clipboardtest_basic clipboardtest_extended PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=wayland;GDK_BACKEND=wayland;GSK_RENDERER=cairo")
add_test(
NAME devicenotifiertest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/devicenotifiertest.py --failfast
)
add_test(
NAME icontest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/icontest.py --failfast
)
add_test(
NAME lock_logouttest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/lock_logouttest.py --failfast
)
add_test(
NAME manage-inputmethodtest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/manage-inputmethodtest.py --failfast
)
add_test(
NAME digitalclocktest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/digitalclocktest.py --failfast
)
set_tests_properties(digitalclocktest PROPERTIES TIMEOUT 120)
add_subdirectory(kicker)
add_test(
NAME logoutgreetertest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/logoutgreetertest.py
)
set_tests_properties(logoutgreetertest PROPERTIES TIMEOUT 300 ENVIRONMENT "PLASMA_SESSION_GUI_TEST=1;USE_CUSTOM_BUS=1;KDE_INSTALL_FULL_LIBEXECDIR=${KDE_INSTALL_FULL_LIBEXECDIR}")
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import PlasmaAppletTest
WIDGET_ID: Final = "org.kde.plasma.analogclock"
class AnalogClockTest(PlasmaAppletTest):
"""
Tests for the analog clock widget
"""
widget_id = WIDGET_ID
extra_environ = {
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;qt.qml.propertyCache.append.warning=false",
}
def test_0_open(self) -> None:
"""
Tests the widget can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Analog Clock")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,119 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import os
import subprocess
import sys
import time
import unittest
from typing import Final
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
from gi.repository import Gio, GLib
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
WIDGET_ID: Final = "org.kde.plasma.appmenu"
KDE_VERSION: Final = 6
CMAKE_RUNTIME_OUTPUT_DIRECTORY: Final = os.getenv("CMAKE_RUNTIME_OUTPUT_DIRECTORY", os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, "build", "bin"))
def name_has_owner(session_bus: Gio.DBusConnection, name: str) -> bool:
"""
Whether the given name is available on session bus
"""
message: Gio.DBusMessage = Gio.DBusMessage.new_method_call("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "NameHasOwner")
message.set_body(GLib.Variant("(s)", [name]))
reply, _ = session_bus.send_message_with_reply_sync(message, Gio.DBusSendMessageFlags.NONE, 1000)
return reply and reply.get_signature() == 'b' and reply.get_body().get_child_value(0).get_boolean()
class AppMenuTest(unittest.TestCase):
"""
Tests for the appmenu widget
"""
driver: webdriver.Remote
kded: subprocess.Popen | None = None
@classmethod
def setUpClass(cls) -> None:
"""
Opens the widget and initialize the webdriver
"""
session_bus: Gio.DBusConnection = Gio.bus_get_sync(Gio.BusType.SESSION)
if not name_has_owner(session_bus, f"org.kde.kded{KDE_VERSION}"):
cls.kded = subprocess.Popen([f"kded{KDE_VERSION}"])
kded_started: bool = False
for _ in range(10):
if name_has_owner(session_bus, f"org.kde.kded{KDE_VERSION}"):
kded_started = True
break
print(f"waiting for kded{KDE_VERSION} to appear on the dbus session")
time.sleep(1)
assert kded_started, "kded is not started"
kded_reply: GLib.Variant = session_bus.call_sync(f"org.kde.kded{KDE_VERSION}", "/kded", f"org.kde.kded{KDE_VERSION}", "loadModule", GLib.Variant("(s)", ["appmenu"]), GLib.VariantType("(b)"), Gio.DBusSendMessageFlags.NONE, 1000)
assert kded_reply.get_child_value(0).get_boolean(), "appmenu module is not loaded"
options = AppiumOptions()
options.set_capability("app", f"plasmawindowed -p org.kde.plasma.nano {WIDGET_ID}")
options.set_capability("environ", {
"LC_ALL": "en_US.UTF-8",
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;qt.qml.propertyCache.append.warning=false",
})
options.set_capability("timeouts", {'implicit': 10000})
cls.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
def tearDown(self) -> None:
"""
Take screenshot when the current test fails
"""
if not self._outcome.result.wasSuccessful():
if os.getenv("TEST_WITH_KWIN_WAYLAND", "1") == "0":
subprocess.check_call(["import", "-window", "root", f"failed_test_shot_{WIDGET_ID}_#{self.id()}.png"])
else:
self.driver.get_screenshot_as_file(f"failed_test_shot_{WIDGET_ID}_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
"""
Make sure to terminate the driver again, lest it dangles.
"""
if cls.kded is not None:
subprocess.check_call([f"kquitapp{KDE_VERSION}", f"kded{KDE_VERSION}"])
cls.kded.wait(5)
cls.driver.quit()
def test_0_open(self) -> None:
"""
Tests the widget can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Global Menu")
def test_1_gtk_application_menu(self) -> None:
"""
Activate a window with two hidden submenus and match strings in the widget
"""
app = subprocess.Popen(["python3", os.path.join(os.path.dirname(os.path.abspath(__file__)), "appmenutest_window.py")], stdout=sys.stderr, stderr=sys.stderr)
self.addCleanup(app.kill)
menu1 = self.driver.find_element(AppiumBy.NAME, "foo")
menu2 = self.driver.find_element(AppiumBy.NAME, "bar")
app.terminate()
app.wait()
wait = WebDriverWait(self.driver, 5)
wait.until(EC.invisibility_of_element(menu1))
wait.until(EC.invisibility_of_element(menu2))
if __name__ == '__main__':
try:
from PySide6.QtCore import QObject
except ModuleNotFoundError:
sys.exit(0)
unittest.main()
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
from PySide6.QtWidgets import QApplication, QMainWindow, QMenu
from PySide6.QtCore import QTimer
class TestWindow(QMainWindow):
def __init__(self, parent=None) -> None:
super().__init__(parent)
self.setWindowTitle("Test Window")
menu_bar = self.menuBar()
foo_menu = QMenu("&foo", self)
bar_menu = QMenu("&bar", self)
menu_bar.addMenu(foo_menu)
menu_bar.addMenu(bar_menu)
menu_bar.setVisible(False)
QTimer.singleShot(60000, self.close)
if __name__ == "__main__":
app = QApplication([])
app.setDesktopFileName("org.kde.testwindow")
win = TestWindow()
win.show()
app.exec()
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import PlasmaAppletTest
WIDGET_ID: Final = "org.kde.plasma.calendar"
class CalendarTest(PlasmaAppletTest):
"""
Tests for the calendar widget
"""
widget_id = WIDGET_ID
extra_environ = {
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;qt.qml.propertyCache.append.warning=false",
}
def test_0_open(self) -> None:
"""
Tests the widget can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Today")
self.driver.find_element(AppiumBy.NAME, "Days")
self.driver.find_element(AppiumBy.NAME, "Months")
self.driver.find_element(AppiumBy.NAME, "Years")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,120 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import os
import subprocess
import sys
import unittest
from typing import Final
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
WIDGET_ID: Final = "org.kde.plasma.cameraindicator"
class CameraIndicatorTest(unittest.TestCase):
"""
Tests for the camera indicator widget
"""
driver: webdriver.Remote
pipewire_already_running_before_test: bool = False
process_list: list[subprocess.Popen] = []
@classmethod
def setUpClass(cls) -> None:
"""
Opens the widget and initialize the webdriver
"""
options = AppiumOptions()
options.set_capability("app", f"plasmawindowed -p org.kde.plasma.nano {WIDGET_ID}")
options.set_capability("environ", {
"LC_ALL": "en_US.UTF-8",
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;qt.qml.propertyCache.append.warning=false",
})
options.set_capability("timeouts", {'implicit': 10000})
cls.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
cls.pipewire_already_running_before_test = subprocess.Popen(["pidof", "pipewire"]).wait() == 0
def tearDown(self) -> None:
"""
Take screenshot when the current test fails
"""
if not self._outcome.result.wasSuccessful():
self.driver.get_screenshot_as_file(f"failed_test_shot_cameraindicatortest_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
"""
Make sure to terminate the driver again, lest it dangles.
"""
assert len(cls.process_list) > 0, len(cls.process_list)
for p in reversed(cls.process_list):
p.kill()
p.wait(10)
cls.driver.quit()
def test_0_open(self) -> None:
"""
Tests the widget can be opened
"""
if self.pipewire_already_running_before_test:
self.driver.find_element(AppiumBy.NAME, "No camera is in use")
else:
self.driver.find_element(AppiumBy.NAME, "Camera indicator is unavailable")
def test_1_connect_to_pipewire(self) -> None:
"""
Tests the widget can connect to pipewire
"""
if self.pipewire_already_running_before_test:
self.skipTest("Pipewire is already running.")
self.process_list.append(subprocess.Popen(["pipewire"], stdout=sys.stderr, stderr=sys.stderr))
self.process_list.append(subprocess.Popen(["wireplumber"], stdout=sys.stderr, stderr=sys.stderr))
# Reconnecting takes at least 5s
WebDriverWait(self.driver, 20).until(EC.presence_of_element_located((AppiumBy.NAME, "No camera is in use")))
def test_2_camera_stream(self) -> None:
"""
Camera status is reported in the widget
"""
# Open two mock cameras to show the camera list
bin_dir = os.getenv("CMAKE_RUNTIME_OUTPUT_DIRECTORY", os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, "build", "bin"))
mock_camera1 = subprocess.Popen([os.path.join(bin_dir, "pipewiremockcamera")], stdout=subprocess.PIPE, stderr=sys.stderr)
mock_camera2 = subprocess.Popen([os.path.join(bin_dir, "pipewiremockcamera")], stdout=sys.stderr, stderr=sys.stderr)
self.process_list.append(mock_camera1)
self.process_list.append(mock_camera2)
self.driver.find_element(AppiumBy.NAME, "KDE Camera")
self.driver.find_element("description", "Suspended")
# Get the node id of the first mock camera
node_id: str = ""
PREFIX: Final = "node id: "
while True:
line = mock_camera1.stdout.readline().decode().strip()
if line.startswith(PREFIX):
node_id = line[len(PREFIX):]
break
assert int(node_id) > 0, node_id
# Open the camera player and connect to the first mock camera
camera_player = subprocess.Popen([os.path.join(bin_dir, "pipewirecameraplay"), node_id], stdout=sys.stderr, stderr=sys.stderr)
self.process_list.append(camera_player)
self.driver.find_element("description", "Active")
# Show the placeholder message when there is only one camera
mock_camera2.terminate()
self.driver.find_element(AppiumBy.NAME, "A camera is in use")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,69 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2026 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import os
import subprocess
import sys
import unittest
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support.ui import WebDriverWait
class ClipboardDeadlockTest(unittest.TestCase):
"""
A test for the clipboard deadlock issue
"""
driver: webdriver.Remote
@classmethod
def setUpClass(cls) -> None:
options = AppiumOptions()
options.set_capability("app", f"python3 {os.path.join(os.path.dirname(os.path.abspath(__file__)), 'clipboardtest', 'deadlocktestwindow.py')}")
options.set_capability("environ", {
"QT_QPA_PLATFORM": "wayland" if os.getenv("TEST_WITH_KWIN_WAYLAND", "1") != "0" else "xcb",
"LD_PRELOAD": subprocess.check_output(["gcc", "-print-file-name=libasan.so"]).strip().decode(encoding="utf-8"),
})
options.set_capability("timeouts", {'implicit': 10000})
cls.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
def tearDown(self) -> None:
"""
Take screenshot when the current test fails
"""
if not self._outcome.result.wasSuccessful():
self.driver.get_screenshot_as_file(f"failed_test_shot_deadlocktestwindow_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
"""
Make sure to terminate the driver again, lest it dangles.
"""
cls.driver.quit()
def test_0_set_regular_clipboard(self) -> None:
text = "From Normal Clipboard"
self.driver.find_element(AppiumBy.NAME, "Normal Text Edit").send_keys(text)
self.driver.find_element(AppiumBy.NAME, "Submit1").click()
WebDriverWait(self.driver, 10).until(lambda d: d.find_element(AppiumBy.NAME, "Normal Clipboard View").text == text)
WebDriverWait(self.driver, 10).until(lambda d: d.find_element(AppiumBy.NAME, "System Clipboard View").text == text)
def test_1_set_system_clipboard(self) -> None:
text = "From System Clipboard"
self.driver.find_element(AppiumBy.NAME, "System Text Edit").send_keys(text)
self.driver.find_element(AppiumBy.NAME, "Submit2").click()
WebDriverWait(self.driver, 10).until(lambda d: d.find_element(AppiumBy.NAME, "Normal Clipboard View").text == text)
WebDriverWait(self.driver, 10).until(lambda d: d.find_element(AppiumBy.NAME, "System Clipboard View").text == text)
if __name__ == '__main__':
try:
from PySide6.QtCore import QObject
except ModuleNotFoundError:
sys.exit(0)
unittest.main()
@@ -0,0 +1,483 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import base64
import logging
import os
import shutil
import sqlite3
import subprocess
import sys
import tempfile
import threading
import time
import unittest
from typing import Final
import gi
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
from selenium.common.exceptions import (NoSuchElementException, WebDriverException)
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.actions.action_builder import ActionBuilder
from selenium.webdriver.common.actions.interaction import POINTER_MOUSE
from selenium.webdriver.common.actions.mouse_button import MouseButton
from selenium.webdriver.common.actions.pointer_input import PointerInput
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
gi.require_version('Gdk', '4.0')
gi.require_version('GdkPixbuf', '2.0')
gi.require_version('Gtk', '4.0')
from gi.repository import Gdk, GdkPixbuf, Gio, GLib, Gtk
WIDGET_ID: Final = "org.kde.plasma.clipboard"
KDE_VERSION: Final = 6
class TestApplication(Gtk.Application):
def __init__(self) -> None:
super().__init__(application_id="org.kde.plasma.clipboardtest")
# Create history file to suppress warnings
klipper_folder = os.path.join(GLib.get_user_data_dir(), "klipper")
self.klipper_data_file = os.path.join(klipper_folder, "history3.sqlite")
assert not os.path.exists(self.klipper_data_file)
shutil.copytree(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, "klipper/autotests/data/onetextentry"), klipper_folder)
self.driver: webdriver.Remote
self.driver_ready_event = threading.Event()
self.connect("activate", self.on_activate)
self.klipper_proxy = Gio.DBusProxy.new_for_bus_sync(Gio.BusType.SESSION, 0, None, "org.kde.klipper", "/klipper", "org.kde.klipper.klipper")
self.klipper_updated_event = threading.Event()
self.klipper_proxy.connect("g-signal", self.klipper_signal_handler)
GLib.timeout_add_seconds(180, self.quit)
def on_activate(self, _app: Gtk.Application) -> None:
options = AppiumOptions()
options.set_capability("app", f"plasmawindowed -p org.kde.plasma.nano {WIDGET_ID}")
options.set_capability(
"environ",
{
"LC_ALL": "en_US.UTF-8",
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;org.kde.klipper.debug=true;qt.qml.propertyCache.append.warning=false",
})
options.set_capability("timeouts", {'implicit': 5000})
self.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
self.driver_ready_event.set()
def klipper_signal_handler(self, d_bus_proxy: Gio.DBusProxy, sender_name: str, signal_name: str, parameters: GLib.Variant) -> None:
logging.info(f"received signal {signal_name}")
if signal_name == "clipboardHistoryUpdated":
self.klipper_updated_event.set()
@staticmethod
def spin() -> None:
context = GLib.MainContext.default()
count = 0
while context.pending() or count < 10:
count += 1
if not context.pending():
time.sleep(0.1)
continue
context.iteration(may_block=True)
@staticmethod
def spin_until(event: threading.Event) -> None:
context = GLib.MainContext.default()
while not event.is_set() or context.pending():
if not context.pending():
time.sleep(0.1)
continue
context.iteration(may_block=True)
def gtk_copy(self, content_provider: Gdk.ContentProvider, clipboard_mode: int = 0) -> None:
logging.info("gtk_copy")
window = Gtk.Window()
window.set_default_size(20, 20)
button = Gtk.Button(label="Copy Content")
window.set_child(button)
window.set_visible(True)
self.spin()
# Click the button to update the latest serial. See also:
# https://invent.kde.org/plasma/kwin/-/commit/31018c000bbad5dc3b263b7f452b0795dd153ceb
# https://github.com/GNOME/gtk/blob/7da4844dcc2fb2a35457fc4e251c504c8f3d0206/gdk/wayland/gdkseat-wayland.c#L4390
ActionChains(self.driver).send_keys(Keys.SPACE).perform()
self.spin()
if clipboard_mode == 0:
clipboard = window.get_display().get_clipboard() # Clipboard
else:
clipboard = window.get_display().get_primary_clipboard() # Selection
assert clipboard.set_content(content_provider)
self.spin()
window.set_visible(False)
self.spin()
def gtk_get_clipboard_mime_data(self, clipboard_mode: int = 0) -> dict[str, GLib.Bytes]:
logging.info("gtk_get_clipboard_mime_data")
window = Gtk.Window()
window.set_default_size(20, 20)
button = Gtk.Button(label="Get Content")
window.set_child(button)
window.set_visible(True)
self.spin()
if clipboard_mode == 0:
clipboard = window.get_display().get_clipboard() # Clipboard
else:
clipboard = window.get_display().get_primary_clipboard() # Selection
self.spin()
data: dict[str, GLib.Bytes] = {}
read_event = threading.Event()
def on_value_read(_clipboard: Gdk.Clipboard, result: Gio.AsyncResult, user_data) -> None:
nonlocal data, read_event
stream, t = _clipboard.read_finish(result)
logging.info(f"reading data for {t}")
data[t] = stream.read_bytes(10000, None)
logging.info(f"reading done")
read_event.set()
for t in clipboard.get_formats().get_mime_types():
if t.startswith("image/") and not t.endswith("png"):
continue
if t.startswith("application/x-qt-image"):
continue
ActionChains(self.driver).send_keys(Keys.SPACE).perform()
clipboard.read_async([t, None], GLib.PRIORITY_DEFAULT, None, on_value_read, None)
self.spin_until(read_event)
read_event.clear()
window.set_visible(False)
self.spin()
return data
class ClipboardTest(unittest.TestCase):
"""
Tests for the clipboard widget
"""
@classmethod
def setUpClass(cls) -> None:
app.driver_ready_event.wait(10)
def tearDown(self) -> None:
"""
Take screenshot when the current test fails
"""
if not self._outcome.result.wasSuccessful():
app.driver.get_screenshot_as_file(f"failed_test_shot_{WIDGET_ID}_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
"""
Make sure to terminate the driver again, lest it dangles.
"""
subprocess.check_call([f"kquitapp{KDE_VERSION}", "plasmawindowed"])
for _ in range(10):
try:
subprocess.check_call(["pidof", "plasmawindowed"])
except subprocess.CalledProcessError:
break
time.sleep(1)
app.driver.quit()
app.quit()
def test_0_open(self) -> None:
"""
Tests the widget can be opened and the history can be loaded
"""
app.driver.find_element(AppiumBy.NAME, "Fushan Wen")
app.driver.find_element(AppiumBy.NAME, "clipboard")
self.assertEqual(app.klipper_proxy.getClipboardContents(), "Fushan Wen")
def test_basic(self) -> None:
"""
The basic part tests the GUI buttons
"""
# Tests the barcode page can be opened
actions = ActionChains(app.driver)
actions.send_keys(Keys.DOWN).perform()
# Wait until the first item is selected
try:
app.driver.find_element(AppiumBy.NAME, "Show QR code").click()
except NoSuchElementException:
actions.send_keys(Keys.DOWN).perform() # Try pressing down key again
app.driver.find_element(AppiumBy.NAME, "Show QR code").click()
app.driver.find_element(AppiumBy.NAME, "QR Code")
app.driver.find_element(AppiumBy.NAME, "Return to Clipboard")
# Go back to the list from the barcode page
button_item = app.driver.find_element(AppiumBy.NAME, "Return to Clipboard")
self.assertTrue(button_item.is_displayed())
button_item.click()
app.driver.find_element(AppiumBy.NAME, "Fushan Wen")
self.assertFalse(button_item.is_displayed())
# In edit mode, the text area should be focused by default.
ActionChains(app.driver).send_keys(Keys.DOWN).send_keys(Keys.DOWN).perform()
app.driver.find_element(AppiumBy.NAME, "Edit contents").click()
app.driver.find_element(AppiumBy.NAME, "Text edit area")
time.sleep(1)
# By default the text area is focused, so typing anything will appear in the text area.
new_text = "clip bold"
ActionChains(app.driver).key_down(Keys.CONTROL).send_keys("a").key_up(Keys.CONTROL).perform() # Select all
ActionChains(app.driver).key_down(Keys.CONTROL).send_keys("a").key_up(Keys.CONTROL).perform() # Perform twice to make it less flaky
ActionChains(app.driver).send_keys(new_text).pause(1).perform()
ActionChains(app.driver).key_down(Keys.CONTROL).send_keys("s").key_up(Keys.CONTROL).perform() # Save
app.driver.find_element(AppiumBy.NAME, new_text)
self.assertEqual(app.gtk_get_clipboard_mime_data()["text/plain;charset=utf-8"].get_data().decode("utf-8"), new_text)
# BUG 494145: update uuid after editing so the item can be removed
delete_button = app.driver.find_element(AppiumBy.NAME, "Remove from history")
delete_button.click()
WebDriverWait(app.driver, 5).until(EC.invisibility_of_element(delete_button))
# The first item becomes the current clipboard item
self.assertEqual(app.gtk_get_clipboard_mime_data()["text/plain;charset=utf-8"].get_data().decode("utf-8"), "clipboard")
item = app.driver.find_element(AppiumBy.NAME, "clipboard")
app.driver.find_element(AppiumBy.NAME, "Clear History").click()
app.driver.find_element(AppiumBy.NAME, "Delete").click()
WebDriverWait(app.driver, 5).until(EC.invisibility_of_element(item))
# Star/Pin feature
app.klipper_proxy.clearClipboardHistory()
app.spin()
for new_text in ("star 1", "normal 1"):
content_text = Gdk.ContentProvider.new_for_bytes("text/plain;charset=utf-8", GLib.Bytes.new(bytes(new_text, "utf-8")))
app.gtk_copy(content_text)
app.driver.find_element(AppiumBy.NAME, "normal 1")
ActionChains(app.driver).send_keys(Keys.DOWN).send_keys(Keys.DOWN).perform()
app.driver.find_element(AppiumBy.NAME, "Star").click()
tabbar_element = app.driver.find_element(AppiumBy.NAME, "Starred Only")
tabbar_element.click()
app.driver.find_element(AppiumBy.NAME, "star 1")
time.sleep(1) # Wait for animation
self.assertRaises((WebDriverException, NoSuchElementException), app.driver.find_element, AppiumBy.NAME, "normal 1")
ActionChains(app.driver).send_keys(Keys.DOWN).perform()
app.driver.find_element(AppiumBy.NAME, "Remove Star").click()
app.driver.find_element(AppiumBy.NAME, "normal 1")
WebDriverWait(app.driver, 5).until(EC.invisibility_of_element(tabbar_element))
def update_config(self, group: str | list[str], key: str | list[str], new_value: str | list[str]) -> None:
if isinstance(group, str):
subprocess.check_call([f"kwriteconfig{KDE_VERSION}", "--file", "klipperrc", "--group", group, "--key", key, new_value])
else:
for g, k, v in zip(group, key, new_value):
subprocess.check_call([f"kwriteconfig{KDE_VERSION}", "--file", "klipperrc", "--group", g, "--key", k, v])
app.klipper_proxy.reloadConfig()
def take_screenshot(self) -> str:
with tempfile.TemporaryDirectory() as temp_dir:
saved_image_path = os.path.join(temp_dir, "tray.png")
app.driver.get_screenshot_as_file(saved_image_path)
return base64.b64encode(Gdk.Texture.new_from_filename(saved_image_path).save_to_png_bytes().get_data()).decode()
def test_extended(self) -> None:
"""
The extended part tests the inner klipper code.
"""
# D-Bus interface for Klipper
app.klipper_proxy.clearClipboardHistory()
app.spin()
app.klipper_updated_event.clear()
# setClipboardContents with a valid string
clipboard_content = "setFromTest"
app.klipper_proxy.setClipboardContents("(s)", clipboard_content)
element = app.driver.find_element(AppiumBy.NAME, clipboard_content)
app.spin()
self.assertTrue(app.klipper_updated_event.is_set())
# self.assertEqual(app.gtk_get_clipboard_mime_data()["text/plain;charset=utf-8"].get_data().decode("utf-8"), clipboard_content) TODO: this doesn't work on Wayland
# setClipboardContents with an empty string
app.klipper_updated_event.clear()
app.klipper_proxy.setClipboardContents("(s)", "")
app.spin()
self.assertFalse(app.klipper_updated_event.is_set())
# History item
self.assertIn(clipboard_content, app.klipper_proxy.getClipboardHistoryMenu())
self.assertEqual(app.klipper_proxy.getClipboardHistoryItem("(i)", 0), clipboard_content)
self.assertEqual(app.klipper_proxy.getClipboardHistoryItem("(i)", 123), "") # Invalid index
# clearClipboardHistory
app.klipper_updated_event.clear()
last_modified = os.stat(app.klipper_data_file).st_mtime
app.klipper_proxy.clearClipboardHistory()
app.klipper_proxy.saveClipboardHistory()
app.spin()
self.assertTrue(app.klipper_updated_event.is_set())
self.assertFalse(element.is_displayed())
self.assertNotEqual(last_modified, os.stat(app.klipper_data_file).st_mtime)
# The PreviewImageProvider registers a custom image provider to load previews for URLs.
new_text = "clip thin"
pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 256, 256)
with tempfile.TemporaryDirectory() as temp_dir:
colors = (0xff0000ff, 0x00ff00ff, 0x0000ffff)
for color in colors:
pixbuf.fill(color)
pixbuf.savev(os.path.join(temp_dir, f"{str(color)}.png"), "png")
uri_list = '\r\n'.join([f"file://{os.path.join(temp_dir, path)}" for path in os.listdir(temp_dir)]) + '\r\n'
content_urls = Gdk.ContentProvider.new_for_bytes("text/uri-list", GLib.Bytes.new(bytes(uri_list, "utf-8")))
content_text = Gdk.ContentProvider.new_for_bytes("text/plain", GLib.Bytes.new(bytes(new_text, "utf-8")))
content_union = Gdk.ContentProvider.new_union([content_text, content_urls])
app.gtk_copy(content_union) # URL has the highest priority
time.sleep(1) # Asynchronous loading
partial_pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 16, 16)
for color in colors:
partial_pixbuf.fill(color)
partial_image = base64.b64encode(Gdk.Texture.new_for_pixbuf(partial_pixbuf).save_to_png_bytes().get_data()).decode()
try:
app.driver.find_image_occurrence(self.take_screenshot(), partial_image)
except WebDriverException: # Flaky
time.sleep(1)
app.driver.find_image_occurrence(self.take_screenshot(), partial_image)
self.assertRaises(NoSuchElementException, app.driver.find_element, AppiumBy.NAME, new_text)
# A cell has both image data and text data, which should not be ignored when images are ignored.
utf8_text = "你好世界"
ascii_text = "helloworld"
pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 256, 256)
pixbuf.fill(0xff0000ff)
content_image = Gdk.ContentProvider.new_for_bytes("image/png", Gdk.Texture.new_for_pixbuf(pixbuf).save_to_png_bytes())
content_text = Gdk.ContentProvider.new_for_bytes("text/plain;charset=utf-8", GLib.Bytes.new(bytes(utf8_text, "utf-8")))
content_asciitext = Gdk.ContentProvider.new_for_bytes("text/plain;charset=ANSI_X3.4-1968", GLib.Bytes.new(bytes(ascii_text, "ANSI_X3.4-1968")))
content_union = Gdk.ContentProvider.new_union([content_text, content_asciitext, content_image])
app.gtk_copy(content_union)
app.driver.find_element(AppiumBy.NAME, utf8_text)
# When a mimedata has "x-kde-passwordManagerHint" set to "secret", the clip should not be saved to history.
try:
from PySide6.QtCore import QObject
process = subprocess.Popen(["python3", os.path.join(os.path.dirname(os.path.abspath(__file__)), "clipboardtest", "copysecret.py")], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
self.addCleanup(process.kill)
process.stderr.readline()
process.stderr.readline()
ActionChains(app.driver).send_keys(Keys.SPACE).perform()
app.driver.find_element(AppiumBy.NAME, "123456789")
self.assertRaises(NoSuchElementException, app.driver.find_element, AppiumBy.NAME, "123456789test")
except ModuleNotFoundError:
pass
# Klipper's history should preserve more MIME types
app.klipper_proxy.clearClipboardHistory()
pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 1, 1) # 1x1 pixel
pixbuf.fill(0xff0000ff)
content_image = Gdk.ContentProvider.new_for_bytes("image/png", Gdk.Texture.new_for_pixbuf(pixbuf).save_to_png_bytes())
utf8_text_data = GLib.Bytes.new(bytes("bug491961", "utf-8"))
utf8_text = Gdk.ContentProvider.new_for_bytes("text/plain;charset=utf-8", utf8_text_data)
ascii_text_data = GLib.Bytes.new(bytes("bug491961", "ANSI_X3.4-1968"))
ascii_text = Gdk.ContentProvider.new_for_bytes("text/plain;charset=ANSI_X3.4-1968", ascii_text_data)
temp_file = tempfile.NamedTemporaryFile(suffix=".txt")
urls_data = GLib.Bytes.new(bytes(f"file://{temp_file.name}\r\n", "utf-8"))
content_urls = Gdk.ContentProvider.new_for_bytes("text/uri-list", urls_data)
content_application = Gdk.ContentProvider.new_for_bytes("application/json", GLib.Bytes.new(bytes("abcdefg", "utf-8")))
content_union = Gdk.ContentProvider.new_union([ascii_text, utf8_text, content_image, content_urls, content_application])
app.gtk_copy(content_union)
app.driver.find_element(AppiumBy.NAME, f"file://{temp_file.name}")
con = sqlite3.connect(f"file:{app.klipper_data_file}?mode=ro", uri=True)
cur = con.cursor()
res_cur = cur.execute("SELECT mimetypes,text FROM main ORDER BY added_time DESC")
res = res_cur.fetchone()
mime_types = res[0].split(",")
self.assertIn("text/plain;charset=utf-8", mime_types)
self.assertNotIn("text/plain;charset=ANSI_X3.4-1968", mime_types)
self.assertIn("image/png", mime_types)
self.assertIn("text/uri-list", mime_types)
self.assertIn("application/json", mime_types)
self.assertEqual(res[1], f"file://{temp_file.name}")
con.close()
# When "Text selection - Always save in history" is enabled, a clip with empty text can crash klipper.
# @see https://bugs.kde.org/show_bug.cgi?id=487843
# @see https://bugs.kde.org/show_bug.cgi?id=466414
# Enable "Text selection - Always save in history" to test the two bugs
self.update_config(["General"] * 2, ["IgnoreSelection", "SyncClipboards"], ["false", "true"])
content_text = Gdk.ContentProvider.new_for_bytes("text/plain", GLib.Bytes.new(bytes("", "utf-8")))
# Clip data from Firefox have additional mime types, which cause the crash
content_application = Gdk.ContentProvider.new_for_bytes("application/whatever", GLib.Bytes.new(bytes("abc", "utf-8")))
content_union = Gdk.ContentProvider.new_union([content_text, content_application])
app.gtk_copy(content_union)
new_text = "Hello World"
app.gtk_copy(Gdk.ContentProvider.new_for_bytes("text/plain", GLib.Bytes.new(bytes(new_text, "utf-8"))))
# self.assertEqual(app.gtk_get_clipboard_mime_data()["text/plain;charset=utf-8"].get_data().decode("utf-8"), new_text) Broken in CI
app.driver.find_element(AppiumBy.NAME, new_text) # Still alive
# When `IgnoreImages` is set to false, the clipboard should save images.
try:
from PySide6.QtCore import QObject
# Enable "Only when explicitly copied" to test the two bugs
self.update_config(["General"] * 3, ["IgnoreImages", "IgnoreSelection", "SyncClipboards"], ["false", "true", "false"])
app.klipper_proxy.clearClipboardHistory()
self.assertEqual(0, len(app.klipper_proxy.getClipboardHistoryMenu()))
# Copy 1 color blocks to clipboard
colors = (0xff0000ff, )
process = subprocess.Popen(["python3", os.path.join(os.path.dirname(os.path.abspath(__file__)), "clipboardtest", "bug497735_simultaneous_clipboard_requests.py"), "-w", "1000", "-h", "1000"], stdout=sys.stderr, stderr=subprocess.PIPE)
self.addCleanup(process.kill)
assert process.stderr is not None
process.stderr.readline() # From resizeEvent
process.stderr.readline() # From resizeEvent
action = ActionBuilder(app.driver, mouse=PointerInput(POINTER_MOUSE, "mouse"))
action.pointer_action.move_to_location(100, 100).click(None, MouseButton.LEFT)
action.perform()
process.stderr.readline()
try:
self.assertEqual(len(colors), len(app.klipper_proxy.getClipboardHistoryMenu()))
except AssertionError: # Flaky
time.sleep(1)
self.assertEqual(len(colors), len(app.klipper_proxy.getClipboardHistoryMenu()))
for color in colors:
# Match the color block in the history
partial_pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 16, 16)
partial_pixbuf.fill(color)
partial_image = base64.b64encode(Gdk.Texture.new_for_pixbuf(partial_pixbuf).save_to_png_bytes().get_data()).decode()
try:
app.driver.find_image_occurrence(self.take_screenshot(), partial_image)
except WebDriverException: # Flaky
time.sleep(1)
app.driver.find_image_occurrence(self.take_screenshot(), partial_image)
except ModuleNotFoundError:
pass
# Clips should not be saved across desktop sessions when "Save history across desktop sessions" is disabled.
app.klipper_proxy.setClipboardContents("(s)", "appiumtest")
app.driver.find_element(AppiumBy.NAME, "appiumtest")
self.update_config("General", "KeepClipboardContents", "false")
app.driver.find_element(AppiumBy.NAME, "Clipboard is empty")
if __name__ == '__main__':
assert subprocess.call(["pidof", "plasmashell"]) != 0, "The test requires plasmashell to quit"
assert os.getenv("GDK_BACKEND") == "wayland", "The test requires wayland GDK_BACKEND"
assert os.getenv("QT_QPA_PLATFORM") == "wayland", "The test requires wayland QT_QPA_PLATFORM"
logging.getLogger().setLevel(logging.INFO)
app = TestApplication()
app.run(None)
unittest.main(failfast=True)
@@ -0,0 +1,66 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2025 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import sys
from PySide6.QtCore import QCommandLineOption, QCommandLineParser, QMimeData, QTimer
from PySide6.QtGui import QColor, QImage, QPainter
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
class MainWindow(QMainWindow):
def __init__(self, width: str, height: str):
super().__init__()
self.setWindowTitle("Gradient Generator")
self.setGeometry(0, 0, 400, 300)
self.button = QPushButton(text="Copy To Clipboard", parent=self)
self.button.clicked.connect(self.on_button_clicked)
self.setCentralWidget(self.button)
self.width = int(width)
self.height = int(height)
self.images = []
for color in (QColor(255, 0, 0), ):
image = QImage(self.width, self.height, QImage.Format_ARGB32_Premultiplied)
painter = QPainter(image)
painter.fillRect(0, 0, self.width, self.height, color)
painter.end()
self.images.append(image)
self.pressed_count = 0
def resizeEvent(self, event) -> None:
print("window resized", file=sys.stderr)
def on_button_clicked(self) -> None:
self.generate_image()
self.pressed_count += 1
if self.pressed_count == len(self.images):
self.hide()
QTimer.singleShot(1000, self, QApplication.instance().quit)
def generate_image(self):
mime_data = QMimeData()
mime_data.setImageData(self.images[self.pressed_count])
QApplication.clipboard().setMimeData(mime_data)
print("copied", file=sys.stderr)
if __name__ == "__main__":
app = QApplication(sys.argv)
parser = QCommandLineParser()
width_option = QCommandLineOption(['w', "width"], "", 'Image width', "1000")
parser.addOption(width_option)
height_option = QCommandLineOption(['h', "height"], "", 'Image height', "1000")
parser.addOption(height_option)
parser.process(app)
window = MainWindow(parser.value(width_option), parser.value(height_option))
window.showFullScreen()
sys.exit(app.exec())
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import sys
from PySide6.QtCore import QMimeData
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
class ClipboardHelperWindow(QMainWindow):
"""
A window to copy text with the secret hint
"""
def __init__(self) -> None:
super().__init__()
self.setWindowTitle("ClipboardHelper")
self.setGeometry(0, 0, 100, 100)
self.button = QPushButton("Copy Secret", self)
self.button.clicked.connect(self.copy_secret)
self.setCentralWidget(self.button)
def resizeEvent(self, event) -> None:
print("button resized", file=sys.stderr)
def copy_secret(self) -> None:
mimeData = QMimeData()
mimeData.setText("123456789test")
mimeData.setData("x-kde-passwordManagerHint", b"secret")
QApplication.clipboard().setMimeData(mimeData)
mimeData = QMimeData()
mimeData.setText("123456789")
mimeData.setData("x-kde-passwordManagerHint", b"public")
QApplication.clipboard().setMimeData(mimeData)
self.hide() # Move focus to plasmawindowed
if __name__ == "__main__":
app = QApplication(sys.argv)
window = ClipboardHelperWindow()
window.showFullScreen()
sys.exit(app.exec())
@@ -0,0 +1,140 @@
#!/usr/bin/env python3
"""
SPDX-FileCopyrightText: 2025 David Edmundson <davidedmundson@kde.org>
SPDX-FileCopyrightText: 2026 Fushan Wen <qydwhotmail@gmail.com>
SPDX-License-Identifier: LGPL-2.0-or-later
"""
import sys
from KGuiAddons import KSystemClipboard
from PySide6.QtCore import QMimeData, Slot
from PySide6.QtGui import QClipboard
from PySide6.QtWidgets import (QApplication, QGroupBox, QHBoxLayout, QPushButton, QTextEdit, QVBoxLayout, QWidget)
class ClipboardTestWindow(QWidget):
"""
This is a small GUI app which constantly syncs the normal and data control
clipboards. This is useful for confirming all deadlocks are gone.
@see https://invent.kde.org/frameworks/kguiaddons/-/merge_requests/191
"""
def __init__(self) -> None:
super().__init__()
self.setWindowTitle("Clipboard Test")
self.__setup_ui()
def __setup_ui(self) -> None:
self.root_layout = QHBoxLayout(self)
self.normal_clipboard_view = QTextEdit()
self.normal_text_edit = QTextEdit()
self.__setup_regular_clipboard(self.root_layout)
self.system_clipboard_view = QTextEdit()
self.system_text_edit = QTextEdit()
self.__setup_system_clipboard(self.root_layout)
self.resize(600, 500)
def __setup_regular_clipboard(self, parent_layout) -> None:
clipboard = QApplication.clipboard()
group = QGroupBox("Normal Clipboard")
parent_layout.addWidget(group)
group_layout = QVBoxLayout(group)
self.normal_clipboard_view.setAccessibleName("Normal Clipboard View")
self.normal_clipboard_view.setReadOnly(True)
self.normal_clipboard_view.setMinimumHeight(200)
clipboard.changed.connect(self.on_normal_clipboard_changed)
self.normal_clipboard_view.setText(clipboard.text())
group_layout.addWidget(self.normal_clipboard_view)
self.normal_text_edit.setAccessibleName("Normal Text Edit")
self.normal_text_edit.setPlaceholderText("Enter clipboard content here…")
self.normal_text_edit.setMinimumHeight(120)
group_layout.addWidget(self.normal_text_edit)
btn_row = QHBoxLayout()
btn_row.addStretch()
submit_btn = QPushButton("Submit1")
submit_btn.clicked.connect(self.submit_normal_clipboard)
btn_row.addWidget(submit_btn)
group_layout.addLayout(btn_row)
def __setup_system_clipboard(self, parent_layout) -> None:
clipboard = KSystemClipboard.instance()
group = QGroupBox("System Clipboard (QClipboard)")
parent_layout.addWidget(group)
group_layout = QVBoxLayout(group)
self.system_clipboard_view.setAccessibleName("System Clipboard View")
self.system_clipboard_view.setReadOnly(True)
self.system_clipboard_view.setMinimumHeight(200)
clipboard.changed.connect(self.on_system_clipboard_changed)
self.system_clipboard_view.setText(clipboard.text(QClipboard.Mode.Clipboard))
group_layout.addWidget(self.system_clipboard_view)
self.system_text_edit.setAccessibleName("System Text Edit")
self.system_text_edit.setPlaceholderText("Enter clipboard content here…")
self.system_text_edit.setMinimumHeight(120)
group_layout.addWidget(self.system_text_edit)
btn_row = QHBoxLayout()
btn_row.addStretch()
submit_btn = QPushButton("Submit2")
submit_btn.clicked.connect(self.submit_system_clipboard)
btn_row.addWidget(submit_btn)
group_layout.addLayout(btn_row)
@Slot(QClipboard.Mode)
def on_normal_clipboard_changed(self, mode) -> None:
if mode != QClipboard.Mode.Clipboard:
return
clipboard = QApplication.clipboard()
self.normal_clipboard_view.setText(clipboard.text(mode))
@Slot(QClipboard.Mode)
def on_system_clipboard_changed(self, mode) -> None:
if mode != QClipboard.Mode.Clipboard:
return
clipboard = KSystemClipboard.instance()
self.system_clipboard_view.setText(clipboard.text(mode))
@Slot()
def submit_normal_clipboard(self) -> None:
clipboard = QApplication.clipboard()
mime_data = QMimeData()
mime_data.setText(self.normal_text_edit.toPlainText())
clipboard.setMimeData(mime_data, QClipboard.Mode.Clipboard)
@Slot()
def submit_system_clipboard(self) -> None:
clipboard = KSystemClipboard.instance()
mime_data = QMimeData()
mime_data.setText(self.system_text_edit.toPlainText())
clipboard.setMimeData(mime_data, QClipboard.Mode.Clipboard)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = ClipboardTestWindow()
window.show()
sys.exit(app.exec())
@@ -0,0 +1,182 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import subprocess
import time
import unittest
import dbus
import dbusmock
import os
from pathlib import Path
from typing import Final
from selenium.webdriver.common.keys import Keys
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
WIDGET_ID: Final = "org.kde.plasma.devicenotifier"
KDE_VERSION: Final = 6
UDISKS2_TEMPLATE_PATH: Final = "devicenotifiertest/udisks2_mock.py"
class DeviceNotifierTest(dbusmock.DBusTestCase):
"""
Tests for the device notifier widget
"""
driver: webdriver.Remote
@classmethod
def setUpClass(cls) -> None:
"""
Opens the widget, starts a system mock dbus session and initialize the webdriver
"""
cls.start_system_bus()
cls.dbus_con = cls.get_dbus(system_bus=True)
template_path = Path(__file__).parent.resolve() / UDISKS2_TEMPLATE_PATH
(cls.p_mock, cls.obj_udisks2) = cls.spawn_server_template(
str(template_path),
{},
stdout=subprocess.PIPE,
)
cls.dbusmock = dbus.Interface(cls.obj_udisks2, dbusmock.MOCK_IFACE)
options = AppiumOptions()
options.set_capability("app", f"plasmawindowed -p org.kde.plasma.nano {WIDGET_ID}")
options.set_capability("timeouts", {'implicit': 10000})
options.set_capability("environ", {
"LC_ALL": "en_US.UTF-8",
"DBUS_SYSTEM_BUS_ADDRESS": os.environ["DBUS_SYSTEM_BUS_ADDRESS"],
"QT_LOGGING_RULES": "org.kde.applets.devicenotifier.debug=true",
})
cls.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
def tearDown(self) -> None:
"""
Take screenshot when the current test fails
"""
if not self._outcome.result.wasSuccessful():
self.driver.get_screenshot_as_file(f"failed_test_shot_{WIDGET_ID}_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
"""
Make sure to terminate the driver again, lest it dangles.
"""
subprocess.check_call([f"kquitapp{KDE_VERSION}", "plasmawindowed"])
for _ in range(10):
try:
subprocess.check_call(["pidof", "plasmawindowed"])
except subprocess.CalledProcessError:
break
time.sleep(1)
cls.driver.quit()
cls.p_mock.stdout.close()
cls.p_mock.terminate()
cls.p_mock.wait()
def test_0_open(self) -> None:
"""
Tests the widget can be opened
"""
self.driver.find_element(AppiumBy.NAME, "No removable devices attached")
def test_1_show_devices(self) -> None:
"""
Tests the widget can show devices
"""
self.dbusmock.add_mock_device("sda", 1, 1000000000, False)
self.driver.find_element(AppiumBy.NAME, "sda1")
self.dbusmock.add_mock_device("sdb", 1, 1000000000, False)
self.driver.find_element(AppiumBy.NAME, "sdb1")
self.dbusmock.add_mock_device("sdc", 1, 1000000000, False)
self.driver.find_element(AppiumBy.NAME, "sdc1")
mount_and_open_elements = self.driver.find_elements(AppiumBy.NAME, "Mount and Open")
self.assertNotEqual(len(mount_and_open_elements), 3)
expand_elements = self.driver.find_elements(AppiumBy.NAME, "Expand")
self.assertNotEqual(len(expand_elements), 3)
for expand_element in expand_elements:
expand_element.click()
mount = self.driver.find_elements(AppiumBy.NAME, "Mount")
self.assertNotEqual(len(mount), 3)
def test_2_remove_devices(self) -> None:
"""
Tests the widget can remove devices
"""
self.dbusmock.remove_mock_device("sda1")
self.dbusmock.remove_mock_device("sdb1")
self.dbusmock.remove_mock_device("sdc1")
self.driver.find_element(AppiumBy.NAME, "No removable devices attached")
def test_3_mount_device(self) -> None:
"""
Tests the widget can mount a device
"""
self.dbusmock.add_mock_device("sda", 1, 1000000000, False)
expand_element = self.driver.find_element(AppiumBy.NAME, "Expand")
expand_element.click()
mount_element = self.driver.find_element(AppiumBy.NAME, "Mount")
mount_element.click()
self.driver.find_element(AppiumBy.NAME, "Safely remove")
def test_4_unmount_device(self) -> None:
"""
Tests the widget can unmount a device
"""
expand_element = self.driver.find_element(AppiumBy.NAME, "Safely remove")
expand_element.send_keys(Keys.ENTER)
self.driver.find_element(by="description", value="This device can now be safely removed.")
self.driver.find_element(AppiumBy.NAME, "No removable devices attached")
self.dbusmock.remove_mock_device("sda1")
def test_5_check_device(self) -> None:
"""
Tests the widget can check a device
"""
self.dbusmock.add_mock_device("sdb", 1, 1000000000, True)
expand_element = self.driver.find_element(AppiumBy.NAME, "Expand")
expand_element.click()
mount_element = self.driver.find_element(AppiumBy.NAME, "Check for Errors")
mount_element.click()
self.driver.find_element(by="description", value="This device has file system errors.")
def test_6_fix_device(self) -> None:
"""
Tests the widget can fix a device
"""
fix_element = self.driver.find_element(AppiumBy.NAME, "Try to Fix")
fix_element.send_keys(Keys.ENTER)
self.driver.find_element(by="description", value="Successfully repaired!")
self.dbusmock.remove_mock_device("sdb1")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,574 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2025 Bohdan Onofriichuk <bogdan.onofriuchuk@gmail.com>
# SPDX-License-Identifier: MIT
"""udisks2 mock template
This creates the expected methods and properties of the main
UDisks2 object and the manager, and adds methods to manipulate a simple
mock drive.
"""
import dbus
from datetime import datetime
import dbusmock
from dbusmock import MOCK_IFACE
SYSTEM_BUS = True
IS_OBJECT_MANAGER = True
BUS_NAME = "org.freedesktop.UDisks2"
MAIN_OBJ = "/org/freedesktop/UDisks2"
MAIN_IFACE = 'org.freedesktop.UDisks2'
UDISKS2_MANAGER_IFACE = "org.freedesktop.UDisks2.Manager"
UDISKS2_MANAGER_OBJ = "/org/freedesktop/UDisks2/Manager"
UDISKS2_BLOCK_DEVICES = "/org/freedesktop/UDisks2/block_devices/"
UDISKS2_DRIVE_DEVICES = "/org/freedesktop/UDisks2/drives/"
UDISKS2_JOBS = "/org/freedesktop/UDisks2/jobs/"
UDISKS2_JOB_IFACE = "org.freedesktop.UDisks2.Job"
UDISKS2_DRIVE_IFACE = "org.freedesktop.UDisks2.Drive"
UDISKS2_BLOCK_IFACE = "org.freedesktop.UDisks2.Block"
UDISKS2_PARTITION_IFACE = "org.freedesktop.UDisks2.Partition"
UDISKS2_FILESYSTEM_IFACE = "org.freedesktop.UDisks2.Filesystem"
MOUNT_POINT = "/run/media/"
def load(mock, parameters):
supported_filesystems = ["ext4"]
manager_props = {
"Version": dbus.String("2.10.2"),
"SupportedFilesystems": dbus.Array(supported_filesystems, signature="s"),
"SupportedEncryptionTypes": dbus.Array([], signature="s"),
"DefaultEncryptionTypes": dbus.Array([], signature="s"),
}
manager_methods = [
("CanFormat", "s", "(bs)", "ret = self.can_format(args[0]), \"\""),
("CanResize", "s", "(bts)", "ret = self.can_resize(args[0]), \"\""),
("CanCheck", "s", "(bs)", "ret = self.can_check(args[0]), \"\""),
("CanRepair", "s", "(bs)", "ret = self.can_repair(args[0]), \"\""),
("GetBlockDevices", "a{sv}", "ao", "ret = self.get_block_paths()"),
("GetDrives", "a{sv}", "ao", "ret = self.get_drive_paths()"),
]
mock.AddObject(UDISKS2_MANAGER_OBJ, UDISKS2_MANAGER_IFACE, manager_props, manager_methods)
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
obj.block_devices = []
obj.drive_devices = []
obj.dev_t = 0
obj.job_counter = 0
obj.supported_filesystems = supported_filesystems
@dbus.service.method(MOCK_IFACE,
in_signature="sttb", out_signature="")
def add_mock_device(self, device_name, device_number, device_size, is_damaged):
"""
Convenience method to add a mock device
"""
block_full_name = device_name + str(device_number)
drive_full_name = "MOCK_FLASH_" + block_full_name
drive_props = {
"Vendor": dbus.String("MockDevice"),
"Model": dbus.String("MockModel"),
"Revision": dbus.String("MockRevision"),
"Serial": dbus.String("MockSerial"),
"WWN": dbus.String("MockWWN"),
"Id": dbus.String("by-mock-" + str(device_number)),
"Configuration": dbus.Array([], signature="(sa{sv})"),
"Media": dbus.String(""),
"MediaCompatibility": dbus.Array([], signature="s"),
"MediaRemovable": dbus.Boolean(True),
"MediaAvailable": dbus.Boolean(True),
"MediaChangeDetected": dbus.Boolean(True),
"Size": dbus.UInt64(device_size),
"TimeDetected": dbus.UInt64(0),
"TimeMediaDetected": dbus.UInt64(0),
"Optical": dbus.Boolean(False),
"OpticalBlank": dbus.Boolean(False),
"OpticalNumTracks": dbus.UInt32(0),
"OpticalNumAudioTracks": dbus.UInt32(0),
"OpticalNumDataTracks": dbus.UInt32(0),
"OpticalNumSessions": dbus.UInt32(0),
"RotationRate": dbus.Int32(-1),
"ConnectionBus": dbus.String("usb"),
"Seat": dbus.String("seat0"),
"Removable": dbus.Boolean(True),
"Ejectable": dbus.Boolean(True),
"SortKey": dbus.String("mock"),
"CanPowerOff": dbus.Boolean(True),
"SiblingId": dbus.String("mock")
}
drive_methods = [
("Eject", "a{sv}", "", "self.eject_drive(self.drive_name)"),
("SetConfiguration", "a{sv}a{sv}", "", "pass"),
("PowerOff", "a{sv}", "", "pass"),
]
mng_obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
block_props = {
"Device": dbus.ByteArray((MOUNT_POINT + block_full_name).encode("ascii")),
"PreferredDevice": dbus.ByteArray((MOUNT_POINT + block_full_name).encode("ascii")),
"Symlinks": dbus.Array([], signature="ay"),
"DeviceNumber": dbus.UInt64(mng_obj.dev_t),
"Id": dbus.String("by-mock-" + block_full_name),
"Size": dbus.UInt64(device_size),
"ReadOnly": dbus.Boolean(False),
"Drive": dbus.ObjectPath(UDISKS2_DRIVE_DEVICES + drive_full_name),
"MDRaid": dbus.ObjectPath("/"),
"MDRaidMember": dbus.ObjectPath("/"),
"IdUsage": dbus.String("filesystem"),
"IdType": dbus.String("ext4"),
"IdVersion": dbus.String("1.0"),
"IdLabel": dbus.String(block_full_name),
"IdUUID": dbus.String("86bf4da8-af29-406a-86f6-8eb9e11c99bd"),
"Configuration": dbus.Array([], signature="(sa{sv})"),
"CryptoBackingDevice": dbus.ObjectPath("/"),
"HintPartitionable": dbus.Boolean(True),
"HintSystem": dbus.Boolean(False),
"HintIgnore": dbus.Boolean(False),
"HintAuto": dbus.Boolean(False),
"HintName": dbus.String(""),
"HintIconName": dbus.String(""),
"HintSymbolicIconName": dbus.String(""),
"UserspaceMountOptions": dbus.Array([], signature="s"),
}
mng_obj.dev_t += 1
block_methods = [
("AddConfigurationItem", "(sa{sv})a{sv}", "", "pass"),
("RemoveConfigurationItem", "(sa{sv})a{sv}", "", "pass"),
("UpdateConfigurationItem", "(sa{sv})(sa{sv})", "", "pass"),
("GetSecretInformation", "a{sv}", "a(sa{sv})", "pass"),
("Format", "sa{sv}", "", "pass"),
("OpenForBackup", "sa{sv}", "h", "pass"),
("OpenForRestore", "sa{sv}", "h", "pass"),
("OpenForBenchmark", "sa{sv}", "h", "pass"),
("OpenDevice", "sa{sv}", "h", "pass"),
("Rescan", "a{sv}", "", "pass"),
("RestoreEncryptedHeader", "sa{sv}", "", "pass"),
]
filesystem_props = {
"MountPoints": dbus.Array([], signature="ay"),
"Size": dbus.UInt64(device_size),
}
filesystem_methods = [
("SetLabel", "sa{sv}", "", "pass"),
("SetUUID", "sa{sv}", "", "pass"),
("Mount", "a{sv}", "s", "ret = self.mount_filesystem(self.block_name)"),
("Unmount", "a{sv}", "", "self.unmount_filesystem(self.block_name)"),
("Resize", "ta{sv}", "", "pass"),
("Check", "a{sv}", "b", "ret = self.check_filesystem(self.block_name)"),
("Repair", "a{sv}", "b", "ret = self.repair_filesystem(self.block_name)"),
("TakeOwnership", "a{sv}", "", "pass"),
]
block_device_path = UDISKS2_BLOCK_DEVICES + block_full_name
drive_device_path = UDISKS2_DRIVE_DEVICES + drive_full_name
self.save_block_path(block_device_path)
self.save_drive_path(drive_device_path)
self.AddObject(drive_device_path, UDISKS2_DRIVE_IFACE, drive_props, drive_methods)
self.AddObject(block_device_path, UDISKS2_BLOCK_IFACE, block_props, block_methods)
drv_obj = dbusmock.get_object(drive_device_path)
drv_obj.block_name = block_full_name
drv_obj.drive_name = drive_full_name
blk_obj = dbusmock.get_object(block_device_path)
blk_obj.block_name = block_full_name
blk_obj.drive_name = drive_full_name
blk_obj.is_damaged = is_damaged
blk_obj.AddProperties(UDISKS2_FILESYSTEM_IFACE, filesystem_props)
blk_obj.AddMethods(UDISKS2_FILESYSTEM_IFACE, filesystem_methods)
main_obj = dbusmock.get_object(MAIN_OBJ)
main_obj.object_manager_emit_added(drive_device_path)
main_obj.object_manager_emit_added(block_device_path)
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="")
def remove_mock_device(self, device_name):
"""
Convenience method to remove a mock device
"""
block_path = UDISKS2_BLOCK_DEVICES + device_name
blk_obj = dbusmock.get_object(block_path)
drive_path = UDISKS2_DRIVE_DEVICES + blk_obj.drive_name
self.object_manager_emit_removed(block_path)
self.RemoveObject(block_path)
self.remove_block_path(block_path)
self.remove_drive_path(drive_path)
self.object_manager_emit_removed(drive_path)
self.RemoveObject(drive_path)
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="s")
def mount_filesystem(self, device_name):
"""
Convenience method to mount a mock block device object
simulates the org.freedesktop.UDisks2.Filesystem.Mount
"""
path = UDISKS2_BLOCK_DEVICES + device_name
job_path = self.create_job("filesystem-mount", path)
self.finish_job(job_path)
mount_point = MOUNT_POINT + device_name
obj = dbusmock.get_object(path)
mount_points = dbus.Array([], signature="ay")
mount_points.append(dbus.ByteArray(mount_point.encode("ascii")))
obj.Set(UDISKS2_FILESYSTEM_IFACE, "MountPoints", mount_points)
userspace_mount_options = dbus.Array([], signature="s")
userspace_mount_options.append(dbus.String("uhelper=udisks2"))
obj.Set(UDISKS2_BLOCK_IFACE, "UserspaceMountOptions", userspace_mount_options)
return path
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="")
def unmount_filesystem(self, device_name):
"""
Convenience method to unmount a mock block device object
simulate org.freedesktop.UDisks2.Filesystem.Unmount
"""
path = UDISKS2_BLOCK_DEVICES + device_name
job_path = self.create_job("filesystem-unmount", path)
self.finish_job(job_path)
obj = dbusmock.get_object(path)
mount_points = dbus.Array([], signature="ay")
obj.Set(UDISKS2_FILESYSTEM_IFACE, "MountPoints", mount_points)
userspace_mount_options = dbus.Array([], signature="s")
obj.Set(UDISKS2_BLOCK_IFACE, "UserspaceMountOptions", userspace_mount_options)
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="b")
def check_filesystem(self, device_name):
"""
Convenience method to check a mock block device object
simulates org.freedesktop.UDisks2.Filesystem.Check
"""
path = UDISKS2_BLOCK_DEVICES + device_name
job_path = self.create_job("filesystem-check", path)
self.finish_job(job_path)
obj = dbusmock.get_object(path)
return not obj.is_damaged
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="b")
def repair_filesystem(self, device_name):
"""
Convenience method to repair a mock block device object
simulates org.freedesktop.UDisks2.Filesystem.Repair
"""
path = UDISKS2_BLOCK_DEVICES + device_name
job_path = self.create_job("filesystem-repair", path)
obj = dbusmock.get_object(path)
self.finish_job(job_path)
obj.is_damaged = False
return True
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="")
def eject_drive(self, drive_name):
"""
Convenience method to eject a mock block device object which
simulates org.freedesktop.UDisks2.Drive.Eject
"""
drive_path = UDISKS2_DRIVE_DEVICES + drive_name
drive_obj = dbusmock.get_object(drive_path)
block_path = UDISKS2_BLOCK_DEVICES + drive_obj.block_name
old_block_obj = dbusmock.get_object(block_path)
# Workaround: python-dbusmock does not support removing of individual dbus ifaces.
# So remove the block_devices object and then add a new object without the
# 'org.freedesktop.UDisks2.Filesystem' iface.
block_props = {
"Device": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "Device"),
"PreferredDevice": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "PreferredDevice"),
"Symlinks": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "Symlinks"),
"DeviceNumber": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "DeviceNumber"),
"Id": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "Id"),
"Size": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "Size"),
"ReadOnly": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "ReadOnly"),
"Drive": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "Drive"),
"MDRaid": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "MDRaid"),
"MDRaidMember": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "MDRaidMember"),
"IdUsage": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "IdUsage"),
"IdType": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "IdType"),
"IdVersion": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "IdVersion"),
"IdLabel": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "IdLabel"),
"IdUUID": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "IdUUID"),
"Configuration": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "Configuration"),
"CryptoBackingDevice": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "CryptoBackingDevice"),
"HintPartitionable": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "HintPartitionable"),
"HintSystem": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "HintSystem"),
"HintIgnore": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "HintIgnore"),
"HintAuto": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "HintAuto"),
"HintName": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "HintName"),
"HintIconName": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "HintIconName"),
"HintSymbolicIconName": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "HintSymbolicIconName"),
"UserspaceMountOptions": old_block_obj.Get(UDISKS2_BLOCK_IFACE, "UserspaceMountOptions"),
}
block_methods = [
("AddConfigurationItem", "(sa{sv})a{sv}", "", "pass"),
("RemoveConfigurationItem", "(sa{sv})a{sv}", "", "pass"),
("UpdateConfigurationItem", "(sa{sv})(sa{sv})", "", "pass"),
("GetSecretInformation", "a{sv}", "a(sa{sv})", "pass"),
("Format", "sa{sv}", "", "pass"),
("OpenForBackup", "sa{sv}", "h", "pass"),
("OpenForRestore", "sa{sv}", "h", "pass"),
("OpenForBenchmark", "sa{sv}", "h", "pass"),
("OpenDevice", "sa{sv}", "h", "pass"),
("Rescan", "a{sv}", "", "pass"),
("RestoreEncryptedHeader", "sa{sv}", "", "pass"),
]
changed_block_props = {
"HintAuto": dbus.Boolean(0),
"IdUUID": dbus.String(""),
"IdVersion": dbus.String(""),
"IdType": dbus.String(""),
"IdUsage": dbus.String(""),
"Id": dbus.String(""),
"Size": dbus.UInt64(0),
}
changed_drive_props = {
"TimeMediaDetected": dbus.UInt64(0),
"MediaAvailable": dbus.Boolean(False),
"Size": dbus.UInt64(0),
}
job_path = self.create_job("drive-eject", drive_path)
self.finish_job(job_path)
self.RemoveObject(block_path)
self.AddObject(block_path, UDISKS2_BLOCK_IFACE, block_props, block_methods)
main_obj = dbusmock.get_object(MAIN_OBJ)
drive_obj.UpdateProperties(UDISKS2_DRIVE_IFACE, changed_drive_props)
new_block_obj = dbusmock.get_object(block_path)
new_block_obj.block_name = old_block_obj.block_name
new_block_obj.drive_name = old_block_obj.drive_name
new_block_obj.is_damaged = old_block_obj.is_damaged
new_block_obj.UpdateProperties(UDISKS2_BLOCK_IFACE, changed_block_props)
main_obj.EmitSignal(
dbusmock.OBJECT_MANAGER_IFACE, "InterfacesRemoved", "oas", [dbus.ObjectPath(block_path), [dbus.String(UDISKS2_FILESYSTEM_IFACE)]]
)
@dbus.service.method(MOCK_IFACE,
in_signature="ss", out_signature="s")
def create_job(self, operation, device_path) -> str:
"""
Convenience method to create a job
simulates org.freedesktop.UDisks2.Job
"""
mng_obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
job_path = UDISKS2_JOBS + str(mng_obj.job_counter)
mng_obj.job_counter += 1
dt = datetime.now()
props = {
"Operation": dbus.String(operation),
"Progress": dbus.Double(0),
"ProgressValid": dbus.Boolean(False),
"Bytes": dbus.UInt64(0),
"Rate": dbus.UInt64(0),
"StartTime": dbus.UInt64(dt.timestamp()),
"ExpectedEndTime": dbus.UInt64(0),
"Objects": dbus.Array([device_path], signature="o"),
"StartedByUID": dbus.UInt32(0),
"Cancelable": dbus.Boolean(False),
}
methods = [
("Cancel", "a{sv}", "", "pass"),
]
self.AddObject(job_path, UDISKS2_JOB_IFACE, props, methods)
self.object_manager_emit_added(job_path)
return job_path
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="")
def finish_job(self, job_path):
"""
Convenience method to remove a job
simulates org.freedesktop.UDisks2.Job
"""
obj = dbusmock.get_object(job_path)
obj.EmitSignal(UDISKS2_JOB_IFACE, "Completed", "bs", [True,""])
self.object_manager_emit_removed(job_path)
self.RemoveObject(job_path)
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="b")
def can_format(_self, filesystem):
#TODO: implement
return False, 0
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="(bt)")
def can_resize(_self, filesystem):
#TODO: implement
return False, 0
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="b")
def can_check(_self, filesystem):
"""
Convenience method to check if filesystem can be checked
simulates org.freedesktop.UDisks2.Manager.CanCheck
"""
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
return any(elem in filesystem for elem in obj.supported_filesystems)
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="b")
def can_repair(_self, filesystem):
"""
Convenience method to check if filesystem can be repaired
simulates org.freedesktop.UDisks2.Manager.CanRepair
"""
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
return any(elem in filesystem for elem in obj.supported_filesystems)
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="")
def save_block_path(_self, path):
"""
Convenience method to maintain a list of block devices which is used by
org.freedesktop.UDisks2.Manager.GetBlockDevices
"""
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
obj.block_devices.append(str(path))
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="")
def remove_block_path(_self, path):
"""
Convenience method to maintain a list of block devices which is used by
org.freedesktop.UDisks2.Manager.GetBlockDevices
"""
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
obj.block_devices.remove(str(path))
@dbus.service.method(MOCK_IFACE,
in_signature="", out_signature="ao")
def get_block_paths(_self) -> list[str]:
"""
Convenience method to maintain a list of block devices which is used by
org.freedesktop.UDisks2.Manager.GetBlockDevices
"""
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
return obj.block_devices
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="")
def save_drive_path(_self, path):
"""
Convenience method to maintain a list of drive devices which is used by
org.freedesktop.UDisks2.Manager.GetDrives
"""
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
obj.drive_devices.append(str(path))
@dbus.service.method(MOCK_IFACE,
in_signature="s", out_signature="")
def remove_drive_path(_self, path):
"""
Convenience method to maintain a list of drive devices which is used by
org.freedesktop.UDisks2.Manager.GetDrives
"""
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
obj.drive_devices.remove(str(path))
@dbus.service.method(MOCK_IFACE,
in_signature="", out_signature="ao")
def get_drive_paths(_self) -> list[str]:
"""
Convenience method to maintain a list of drive devices which is used by
org.freedesktop.UDisks2.Manager.GetDrives
"""
obj = dbusmock.get_object(UDISKS2_MANAGER_OBJ)
return obj.drive_devices
@@ -0,0 +1,139 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021-2022 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2023 Marco Martin <mart@kde.org>
import subprocess
import time
import unittest
from datetime import date
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
from dateutil.relativedelta import relativedelta
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import PlasmaAppletTest
WIDGET_ID: Final = "org.kde.plasma.digitalclock"
class DigitalClockTests(PlasmaAppletTest):
widget_id = WIDGET_ID
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.driver.find_element(AppiumBy.XPATH, f"//label[contains(@name, '{time.strftime('%I:%M', time.localtime()).lstrip('0')}')]")
cls.driver.find_element(AppiumBy.ACCESSIBILITY_ID, "digital-clock-compactrepresentation").click()
def setUp(self):
self.driver.find_element(by=AppiumBy.NAME, value="Today").click()
self.assertEqual(self.compareMonthLabel(date.today()), True)
def assertResult(self, actual, expected):
wait = WebDriverWait(self.driver, 20)
wait.until(lambda x: self.getresults() == expected)
self.assertEqual(self.getresults(), expected)
def compareMonthLabel(self, dateToTest):
monthLabel = self.driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value="monthHeader")
today = date.today()
monthString = ""
if dateToTest.year == today.year:
monthString = dateToTest.strftime("%B")
else:
monthString = dateToTest.strftime("%B %Y")
return monthLabel.text == monthString
def test_1_next_month(self):
nextMonthDate = date.today() + relativedelta(months=1)
self.driver.find_element(by=AppiumBy.NAME, value="Next Month").click()
wait = WebDriverWait(self.driver, 50)
wait.until(lambda x: self.compareMonthLabel(nextMonthDate))
self.assertEqual(self.compareMonthLabel(nextMonthDate), True)
def test_1_prev_month(self):
lastMonthDate = date.today() - relativedelta(months=1)
self.driver.find_element(by=AppiumBy.NAME, value="Previous Month").click()
wait = WebDriverWait(self.driver, 50)
wait.until(lambda x: self.compareMonthLabel(lastMonthDate))
self.assertEqual(self.compareMonthLabel(lastMonthDate), True)
def test_1_months_view(self):
dateAugust = date.today()
dateAugust = dateAugust.replace(month=8)
self.driver.find_element(by=AppiumBy.NAME, value="Months").click()
self.driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value="calendarCell-{}-{}".format(dateAugust.year, dateAugust.month)).click()
wait = WebDriverWait(self.driver, 50)
wait.until(lambda x: self.compareMonthLabel(dateAugust))
self.assertEqual(self.compareMonthLabel(dateAugust), True)
def test_1_years_view(self):
dateFuture = date.today() + relativedelta(years=2)
self.driver.find_element(by=AppiumBy.NAME, value="Years").click()
self.driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value="calendarCell-{}".format(dateFuture.year)).click()
wait = WebDriverWait(self.driver, 50)
wait.until(lambda x: self.compareMonthLabel(dateFuture))
self.assertEqual(self.compareMonthLabel(dateFuture), True)
def test_2_config_dialog_1_appearance(self) -> None:
"""
Opens the config dialog
"""
subprocess.check_call(["plasmawindowed", "--config"])
wait = WebDriverWait(self.driver, 10)
wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Date format:")))
def test_2_config_dialog_2_calendar_plugin_list(self) -> None:
"""
Checks the calendar plugin list
"""
self.driver.find_element(AppiumBy.NAME, "Calendar").click()
wait = WebDriverWait(self.driver, 10)
wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Available Add-Ons")))
# Enable the plugin (BUG 480668)
plugin_checkbox: WebElement = wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Holidays")))
plugin_checkbox.click()
# Switch back to Appearance so there will only be one "Holidays" match
self.driver.find_element(AppiumBy.NAME, "Appearance").click()
wait.until(EC.invisibility_of_element(plugin_checkbox))
# Switch to the calendar plugin
wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Holidays"))).click()
wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Search")))
def test_2_config_dialog_3_time_zones(self) -> None:
"""
Checks the time zone map
"""
self.driver.find_element(AppiumBy.NAME, "Time Zones").click()
wait = WebDriverWait(self.driver, 10)
wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Add Time Zone…"))).click()
el = wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Timezone region selector")))
el.click()
wait = WebDriverWait(self.driver, 1)
el.send_keys(Keys.DOWN)
el.send_keys(Keys.ENTER)
wait = WebDriverWait(self.driver, 1)
el = wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Timezone location selector")))
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import PlasmaAppletTest
WIDGET_ID: Final = "org.kde.plasma.icon"
class IconTest(PlasmaAppletTest):
"""
Tests for the icon widget
"""
widget_id = WIDGET_ID
extra_environ = {
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;qt.qml.propertyCache.append.warning=false",
}
def test_0_open(self) -> None:
"""
Tests the widget can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Icon")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
add_test(
NAME kicker_favoritetest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/favoritetest.py --failfast
)
execute_process(COMMAND gcc -print-file-name=libasan.so OUTPUT_VARIABLE LIBASAN_PATH ECHO_OUTPUT_VARIABLE OUTPUT_STRIP_TRAILING_WHITESPACE)
set_tests_properties(kicker_favoritetest PROPERTIES
TIMEOUT 120
ENVIRONMENT "LD_PRELOAD=${LIBASAN_PATH};USE_CUSTOM_BUS=1;KACTIVITYMANAGERD_PATH=${KDE_INSTALL_FULL_LIBEXECDIR}/kactivitymanagerd;QMLTEST_EXEC=$<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::qmltestrunner>")
@@ -0,0 +1,415 @@
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<!--
# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-FileCopyrightText: 2018-2020 Stasiek Michalski <hellcp@opensuse.org>
-->
<Menu>
<Name>Applications</Name>
<Directory>kde-main.directory</Directory>
<!-- Search the default locations -->
<DefaultAppDirs/>
<DefaultDirectoryDirs/>
<DefaultLayout>
<Merge type="menus"/>
<Merge type="files"/>
<Separator/>
<Menuname>More</Menuname>
</DefaultLayout>
<Layout>
<Merge type="menus"/>
<Menuname>Applications</Menuname>
<Merge type="files"/>
</Layout>
<Menu>
<Name>Applications</Name>
<Directory>kf5-unknown.directory</Directory>
<OnlyUnallocated/>
<Include>
<Not>
<!-- Don't list non-KDE core applications -->
<And>
<Category>Core</Category>
<Not><Category>KDE</Category></Not>
</And>
<!-- Don't list SUSE's YaST in here -->
<Category>X-SuSE-YaST</Category>
<Category>X-KDE-settings-hardware</Category>
<Category>X-KDE-settings-accessibility</Category>
<Category>X-KDE-settings-components</Category>
<Category>X-KDE-settings-desktop</Category>
<Category>X-KDE-settings-looknfeel</Category>
<Category>X-KDE-settings-network</Category>
<Category>X-KDE-settings-webbrowsing</Category>
<Category>X-KDE-settings-peripherals</Category>
<Category>X-KDE-settings-hardware</Category>
<Category>X-KDE-settings-power</Category>
<Category>X-KDE-settings-security</Category>
<Category>X-KDE-settings-sound</Category>
<Category>X-KDE-settings-system</Category>
<Category>X-KDE-information</Category>
<Filename>kde-kcm_knetworkconfmodule_ss.desktop</Filename>
<Filename>kde-medianotifications.desktop</Filename>
<Filename>kde-audioencoding.desktop</Filename>
</Not>
</Include>
</Menu>
<Menu>
<Name>Development</Name>
<Directory>kf5-development.directory</Directory>
<Menu>
<Name>Translation</Name>
<Directory>kf5-development-translation.directory</Directory>
<Include>
<And>
<Category>Development</Category>
<Category>Translation</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>Web Development</Name>
<Directory>kf5-development-webdevelopment.directory</Directory>
<Include>
<And>
<Category>Development</Category>
<Category>WebDevelopment</Category>
</And>
</Include>
</Menu>
<Include>
<And>
<Category>Development</Category>
<Not><Category>Translation</Category></Not>
<Not><Category>WebDevelopment</Category></Not>
</And>
</Include>
</Menu>
<Menu>
<Name>Science</Name>
<Directory>kf5-science.directory</Directory>
<Include>
<And><!-- Include /any/ Science app which is not an Education app -->
<Or>
<Category>Astronomy</Category>
<Category>Biology</Category>
<Category>Chemistry</Category>
<Category>Geology</Category>
<Category>MedicalSoftware</Category>
<Category>Physics</Category>
<Category>Math</Category>
<Category>Science</Category>
</Or>
<Not><Category>Education</Category></Not>
</And>
</Include>
</Menu>
<Menu>
<Name>Education</Name>
<Directory>kf5-education.directory</Directory>
<Menu>
<Name>Languages</Name>
<Directory>kf5-edu-languages.directory</Directory>
<Include>
<And>
<Category>Education</Category>
<Category>Languages</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>Mathematics</Name>
<Directory>kf5-edu-mathematics.directory</Directory>
<Include>
<And>
<Category>Education</Category>
<Category>Math</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>Miscellaneous</Name>
<Directory>kf5-edu-miscellaneous.directory</Directory>
<Include>
<And>
<Category>Education</Category>
<Not>
<Category>Languages</Category>
<Category>Math</Category>
<Category>Science</Category>
<Category>Teaching</Category>
</Not>
</And>
</Include>
</Menu>
<Menu>
<Name>Science</Name>
<Directory>kf5-edu-science.directory</Directory>
<Include>
<And>
<Category>Education</Category>
<Category>Science</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>Tools</Name>
<Directory>kf5-edu-tools.directory</Directory>
<Include>
<And>
<Category>Education</Category>
<Category>Teaching</Category>
</And>
</Include>
</Menu>
</Menu>
<Menu>
<Name>Games</Name>
<Directory>kf5-games.directory</Directory>
<Menu>
<Name>Arcade</Name>
<Directory>kf5-games-arcade.directory</Directory>
<Include>
<And>
<Category>Game</Category>
<Category>ArcadeGame</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>Board</Name>
<Directory>kf5-games-board.directory</Directory>
<Include>
<And>
<Category>Game</Category>
<Category>BoardGame</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>Card</Name>
<Directory>kf5-games-card.directory</Directory>
<Include>
<And>
<Category>Game</Category>
<Category>CardGame</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>Kidsgames</Name>
<Directory>kf5-games-kids.directory</Directory>
<Include>
<And>
<Category>Game</Category>
<Category>KidsGame</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>TacticStrategy</Name>
<Directory>kf5-games-strategy.directory</Directory>
<Include>
<And>
<Category>Game</Category>
<Category>StrategyGame</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>Logic</Name>
<Directory>kf5-games-logic.directory</Directory>
<Include>
<And>
<Category>Game</Category>
<Category>LogicGame</Category>
</And>
</Include>
</Menu>
<Include>
<And>
<Category>Game</Category>
<Not>
<Category>ArcadeGame</Category>
<Category>BoardGame</Category>
<Category>CardGame</Category>
<Category>KidsGame</Category>
<Category>StrategyGame</Category>
<Category>LogicGame</Category>
</Not>
</And>
</Include>
</Menu>
<Menu>
<Name>Graphics</Name>
<Directory>kf5-graphics.directory</Directory>
<Include>
<And>
<Category>Graphics</Category>
<Not><Category>X-KDE-More</Category></Not>
</And>
</Include>
<Menu>
<Name>More</Name>
<Directory>kf5-more.directory</Directory>
<Include>
<And>
<Category>Graphics</Category>
<Category>X-KDE-More</Category>
</And>
</Include>
</Menu>
</Menu>
<Menu>
<Name>Internet</Name>
<Directory>kf5-internet.directory</Directory>
<Include>
<And>
<Category>Network</Category>
<Not><Category>X-KDE-More</Category></Not>
</And>
</Include>
<Menu>
<Name>Terminal</Name>
<Directory>kf5-internet-terminal.directory</Directory>
</Menu>
<Menu>
<Name>More</Name>
<Directory>kf5-more.directory</Directory>
<Include>
<And>
<Category>Network</Category>
<Category>X-KDE-More</Category>
</And>
</Include>
</Menu>
</Menu>
<Menu>
<Name>Multimedia</Name>
<Directory>kf5-multimedia.directory</Directory>
<Include>
<And>
<Category>AudioVideo</Category>
<Not><Category>X-KDE-More</Category></Not>
</And>
</Include>
<Menu>
<Name>More</Name>
<Directory>kf5-more.directory</Directory>
<Include>
<And>
<Category>AudioVideo</Category>
<Category>X-KDE-More</Category>
</And>
</Include>
</Menu>
</Menu>
<Menu>
<Name>Office</Name>
<Directory>kf5-office.directory</Directory>
<Layout>
<Merge type="menus"/>
<Filename>kde-koshell.desktop</Filename>
<Filename>kde-Kontact.desktop</Filename>
<Separator/>
<Filename>kde-kword.desktop</Filename>
<Filename>kde-kspread.desktop</Filename>
<Filename>kde-kpresenter.desktop</Filename>
<Merge type="files"/>
<Separator/>
<Menuname>More</Menuname>
</Layout>
<Include>
<And>
<Category>Office</Category>
<Not><Category>X-KDE-More</Category></Not>
</And>
</Include>
<Menu>
<Name>More</Name>
<Directory>kf5-more.directory</Directory>
<Include>
<And>
<Category>Office</Category>
<Category>X-KDE-More</Category>
</And>
</Include>
</Menu>
</Menu>
<Menu>
<Name>Settingsmenu</Name>
<Directory>kf5-settingsmenu.directory</Directory>
<Include>
<Category>Settings</Category>
</Include>
</Menu>
<Menu>
<Name>System</Name>
<Directory>kf5-system.directory</Directory>
<Include>
<And>
<Category>System</Category>
<Not><Category>X-KDE-More</Category></Not>
</And>
</Include>
<Menu>
<Name>More</Name>
<Directory>kf5-more.directory</Directory>
<Include>
<And>
<Category>System</Category>
<Category>X-KDE-More</Category>
</And>
</Include>
</Menu>
<Menu>
<Name>ScreenSavers</Name>
<Directory>kf5-system-screensavers.directory</Directory>
</Menu>
<Menu>
<Name>Terminal</Name>
<Directory>kf5-system-terminal.directory</Directory>
</Menu>
</Menu>
<Menu>
<Name>Utilities</Name>
<Directory>kf5-utilities.directory</Directory>
<Include>
<And>
<Category>Utility</Category>
<Not><Category>X-KDE-More</Category></Not>
</And>
<Category>TextEditor</Category>
<Category>Accessibility</Category>
<Category>X-KDE-Utilities-Desktop</Category>
<Category>X-KDE-Utilities-File</Category>
<Category>X-KDE-Utilities-Peripherals</Category>
<Category>X-KDE-Utilities-PIM</Category>
</Include>
<Menu>
<Name>XUtilities</Name>
<Directory>kf5-utilities-xutils.directory</Directory>
</Menu>
<Menu>
<Name>More</Name>
<Directory>kf5-more.directory</Directory>
<Include>
<And>
<Category>Utility</Category>
<Category>X-KDE-More</Category>
</And>
</Include>
</Menu>
</Menu>
<Include>
<And>
<Category>KDE</Category>
<Category>Core</Category>
</And>
</Include>
<DefaultMergeDirs/>
<MergeFile>applications-kmenuedit.menu</MergeFile>
</Menu>
@@ -0,0 +1,162 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2022-2023 Harald Sitter <sitter@kde.org>
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import time
import unittest
from typing import Final
from gi.repository import Gio, GLib
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, "utils"))
from GLibMainLoopThread import GLibMainLoopThread
KDE_VERSION: Final = 6
KACTIVITYMANAGERD_SERVICE_NAME: Final = "org.kde.ActivityManager"
KACTIVITYMANAGERD_PATH: Final = os.getenv("KACTIVITYMANAGERD_PATH", "/usr/libexec/kactivitymanagerd")
QMLTEST_EXEC: Final = os.getenv("QMLTEST_EXEC", "/usr/bin/qmltestrunner6")
def name_has_owner(session_bus: Gio.DBusConnection, name: str) -> bool:
"""
Whether the given name is available on session bus
"""
message: Gio.DBusMessage = Gio.DBusMessage.new_method_call("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "NameHasOwner")
message.set_body(GLib.Variant("(s)", [name]))
reply, _ = session_bus.send_message_with_reply_sync(message, Gio.DBusSendMessageFlags.NONE, 1000)
return reply and reply.get_signature() == 'b' and reply.get_body().get_child_value(0).get_boolean()
def build_ksycoca() -> None:
subprocess.check_call([f"kbuildsycoca{KDE_VERSION}"], stdout=sys.stderr, stderr=sys.stderr, env=os.environ)
def start_kactivitymanagerd() -> subprocess.Popen:
session_bus: Gio.DBusConnection = Gio.bus_get_sync(Gio.BusType.SESSION)
assert not name_has_owner(session_bus, KACTIVITYMANAGERD_SERVICE_NAME)
os.makedirs(os.path.join(GLib.get_user_config_dir(), "menus"))
shutil.copy(os.path.join(os.path.dirname(os.path.abspath(__file__)), "applications.menu"), os.path.join(GLib.get_user_config_dir(), "menus"))
kactivitymanagerd = subprocess.Popen([KACTIVITYMANAGERD_PATH], stdout=sys.stderr, stderr=sys.stderr, env=os.environ)
kactivitymanagerd_started: bool = False
for _ in range(10):
if name_has_owner(session_bus, KACTIVITYMANAGERD_SERVICE_NAME):
kactivitymanagerd_started = True
break
logging.info("waiting for kactivitymanagerd to appear on the DBus session")
time.sleep(1)
assert kactivitymanagerd_started
build_ksycoca()
return kactivitymanagerd
class TestDBusInterface:
"""
D-Bus interface for org.kde.kickertest
"""
BUS_NAME: Final = "org.kde.kickertest"
OBJECT_PATH: Final = "/test"
INTERFACE_NAME: Final = "org.kde.kickertest"
connection: Gio.DBusConnection
def __init__(self) -> None:
self.reg_id: int = 0
self.owner_id: int = Gio.bus_own_name(Gio.BusType.SESSION, self.BUS_NAME, Gio.BusNameOwnerFlags.NONE, self.on_bus_acquired, None, None)
assert self.owner_id > 0
def on_bus_acquired(self, connection: Gio.DBusConnection, name: str, *args) -> None:
"""
The interface is ready, now register objects.
"""
self.connection = connection
introspection_data = Gio.DBusNodeInfo.new_for_xml("""
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.kickertest">
<method name="DeleteAndRebuildDatabase1"/>
<method name="DeleteAndRebuildDatabase2"/>
</interface>
</node>
""")
self.reg_id = connection.register_object(self.OBJECT_PATH, introspection_data.interfaces[0], self.handle_method_call, None, None)
assert self.reg_id > 0
logging.info("interface registered")
def handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
logging.info("method call %s", method_name)
if method_name == "DeleteAndRebuildDatabase1":
os.remove(KickerTest.desktop_entry_1)
build_ksycoca()
invocation.return_value(None)
elif method_name == "DeleteAndRebuildDatabase2":
os.remove(KickerTest.desktop_entry_2)
build_ksycoca()
invocation.return_value(None)
class KickerTest(unittest.TestCase):
kactivitymanagerd: subprocess.Popen
loop_thread: GLibMainLoopThread
dbus_interface: TestDBusInterface
temp_dir: tempfile.TemporaryDirectory
desktop_entry_1: str
desktop_entry_2: str
@classmethod
def setUpClass(cls) -> None:
# Prepare desktop files
# 1
os.makedirs(os.path.join(GLib.get_user_data_dir(), "applications"))
shutil.copy(os.path.join(os.path.dirname(os.path.abspath(__file__)), "kickertest.desktop"), os.path.join(GLib.get_user_data_dir(), "applications"))
cls.desktop_entry_1 = os.path.join(GLib.get_user_data_dir(), "applications", "kickertest.desktop")
# 2
cls.temp_dir = tempfile.TemporaryDirectory()
os.makedirs(os.path.join(cls.temp_dir.name, "applications"))
shutil.copy(os.path.join(os.path.dirname(os.path.abspath(__file__)), "kickertest.desktop"), os.path.join(cls.temp_dir.name, "applications"))
cls.desktop_entry_2 = os.path.join(cls.temp_dir.name, "applications", "kickertest.desktop")
os.environ["LC_ALL"] = "en_US.UTF-8"
os.environ["QT_LOGGING_RULES"] = "org.kde.plasma.kicker.debug=true;kf.coreaddons.kdirwatch.debug=true"
os.environ["XDG_DATA_DIRS"] = os.environ["XDG_DATA_DIRS"] + ":" + cls.temp_dir.name
cls.kactivitymanagerd = start_kactivitymanagerd()
cls.loop_thread = GLibMainLoopThread()
cls.loop_thread.start()
cls.dbus_interface = TestDBusInterface()
@classmethod
def tearDownClass(cls) -> None:
cls.loop_thread.quit()
cls.kactivitymanagerd.kill()
cls.kactivitymanagerd.wait(10)
def test_qml(self) -> None:
"""
1. Add an entry to Favorites
2. Remove the entry from Favorites
3. Hide invalid entries automatically and don't crash when there are multiple entries with the same desktop name
"""
with subprocess.Popen([QMLTEST_EXEC, "-input", os.path.join(os.path.dirname(os.path.abspath(__file__)), 'favoritetest.qml')], stdout=sys.stderr, stderr=sys.stderr) as process:
self.assertEqual(process.wait(60), 0)
if __name__ == '__main__':
assert "USE_CUSTOM_BUS" in os.environ
logging.getLogger().setLevel(logging.INFO)
unittest.main()
@@ -0,0 +1,92 @@
/*
SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
SPDX-License-Identifier: MIT
*/
import QtQuick
import QtTest
import org.kde.plasma.workspace.dbus as DBus
import org.kde.plasma.private.kicker as Kicker
TestCase {
id: root
width: 100
height: 100
when: windowShown
readonly property string service: "org.kde.kickertest"
readonly property string path: "/test"
readonly property string iface: service
function init() {
compare(favoriteList.count, 0);
}
function cleanup() {
compare(favoriteList.count, 0);
}
function test_add_remove_favorite() {
rootModel.favoritesModel.addFavorite("applications:kickertest.desktop");
compare(favoriteList.count, 1);
compare(favoriteList.itemAt(0).text, "DONT TRANSLATE TEST ONLY");
rootModel.favoritesModel.removeFavorite("applications:kickertest.desktop");
tryCompare(favoriteList, "count", 0);
}
function test_hide_invalid_entries() {
rootModel.favoritesModel.addFavorite("applications:kickertest.desktop");
compare(favoriteList.count, 1);
compare(favoriteList.itemAt(0).text, "DONT TRANSLATE TEST ONLY");
let pendingReply = DBus.SessionBus.asyncCall({
"service": root.service,
"path": root.path,
"iface": root.iface,
"member": "DeleteAndRebuildDatabase1",
});
tryCompare(pendingReply, "isFinished", true);
console.log("Waiting 3s...")
wait(3000);
compare(favoriteList.count, 1);
DBus.SessionBus.asyncCall({
"service": root.service,
"path": root.path,
"iface": root.iface,
"member": "DeleteAndRebuildDatabase2",
});
tryCompare(favoriteList, "count", 0);
rootModel.favoritesModel.removeFavorite("applications:kickertest.desktop");
}
Kicker.RootModel {
id: rootModel
autoPopulate: false
appNameFormat: 0 // NameOnly
flat: false
sorted: true
showSeparators: true
showAllApps: false
showAllAppsCategorized: true
showTopLevelItems: true
showRecentApps: true
showRecentDocs: true
recentOrdering: 0 // RecentFirst
Component.onCompleted: {
favoritesModel.initForClient("org.kde.plasma.kicker.favorites.instance-testclient")
}
}
Repeater {
id: favoriteList
model: rootModel.favoritesModel
delegate: Text {
required property var model
width: parent.width
text: model.compactNameWrapped ?? model.compactName ?? model.displayWrapped ?? model.display
textFormat: Text.PlainText
}
}
}
@@ -0,0 +1,51 @@
[Desktop Entry]
Name=DONT TRANSLATE TEST ONLY
Name[be]=DONT TRANSLATE TEST ONLY
Name[bg]=ДА НЕ СЕ ПРЕВЕЖДА, САМО ТЕСТВАНЕ
Name[ca]=DONT TRANSLATE TEST ONLY
Name[ca@valencia]=DONT TRANSLATE TEST ONLY
Name[es]=DONT TRANSLATE TEST ONLY
Name[eu]=DONT TRANSLATE TEST ONLY
Name[fr]=DONT TRANSLATE TEST ONLY
Name[he]=DONT TRANSLATE TEST ONLY
Name[it]=DONT TRANSLATE TEST ONLY
Name[ka]=DONT TRANSLATE TEST ONLY
Name[lt]=DONT TRANSLATE TEST ONLY
Name[lv]=DONT TRANSLATE TEST ONLY
Name[nl]=NIET VERTALEN ALLEEN TESTEN
Name[pl]=DONT TRANSLATE TEST ONLY
Name[sa]=DONT TRANSLATE TEST केवलम्
Name[sl]=DONT TRANSLATE TEST ONLY
Name[sv]=
Name[tr]=DONT TRANSLATE TEST ONLY
Name[uk]=DONT TRANSLATE TEST ONLY
Name[x-test]=xxDONT TRANSLATE TEST ONLYxx
Name[zh_CN]=DONT TRANSLATE TEST ONLY
Comment=DONT TRANSLATE TEST ONLY
Comment[be]=DONT TRANSLATE TEST ONLY
Comment[bg]=ДА НЕ СЕ ПРЕВЕЖДА, САМО ТЕСТВАНЕ
Comment[ca]=DONT TRANSLATE TEST ONLY
Comment[ca@valencia]=DONT TRANSLATE TEST ONLY
Comment[es]=DONT TRANSLATE TEST ONLY
Comment[eu]=DONT TRANSLATE TEST ONLY
Comment[fr]=DONT TRANSLATE TEST ONLY
Comment[he]=DONT TRANSLATE TEST ONLY
Comment[id]=HANYA PENGUJIAN, JANGAN DITERJEMAHKAN
Comment[it]=DONT TRANSLATE TEST ONLY
Comment[ka]=DONT TRANSLATE TEST ONLY
Comment[lt]=DONT TRANSLATE TEST ONLY
Comment[lv]=DONT TRANSLATE TEST ONLY
Comment[nl]=NIET VERTALEN ALLEEN TESTEN
Comment[pl]=DONT TRANSLATE TEST ONLY
Comment[sa]=DONT TRANSLATE TEST केवलम्
Comment[sl]=DONT TRANSLATE TEST ONLY
Comment[sv]=
Comment[tr]=DONT TRANSLATE TEST ONLY
Comment[uk]=DONT TRANSLATE TEST ONLY
Comment[x-test]=xxDONT TRANSLATE TEST ONLYxx
Comment[zh_CN]=DONT TRANSLATE TEST ONLY
Exec=xterm
Icon=xorg
Terminal=false
Type=Application
Categories=Game;
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import os
import sys
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import PlasmaAppletTest
WIDGET_ID: Final = "org.kde.plasma.lock_logout"
class LockLogoutTest(PlasmaAppletTest):
"""
Tests for the lock/logout widget
"""
widget_id = WIDGET_ID
extra_environ = {
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;qt.qml.propertyCache.append.warning=false",
}
def test_0_open(self) -> None:
"""
Tests the widget can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Lock")
self.driver.find_element(AppiumBy.NAME, "Shut down")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,64 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021-2022 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2023 Marco Martin <mart@kde.org>
import os
import subprocess
import unittest
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
KDE_INSTALL_FULL_LIBEXECDIR = os.environ.get("KDE_INSTALL_FULL_LIBEXECDIR", "/usr/libexec")
class LogoutGreeterTests(unittest.TestCase):
def setUp(self):
self.proc = subprocess.Popen(["{}/ksmserver-logout-greeter".format(KDE_INSTALL_FULL_LIBEXECDIR), "--windowed"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
options = AppiumOptions()
options.set_capability("app", str(self.proc.pid))
options.set_capability("timeouts", {'implicit': 10000})
options.set_capability("environ", {
"LC_ALL": "en_US.UTF-8",
})
self.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
def tearDown(self):
self.driver.quit()
self.assertEqual(self.proc.returncode != None, True)
try:
self.proc.terminate()
self.proc.wait(10)
except subprocess.TimeoutExpired:
self.proc.kill()
if not self._outcome.result.wasSuccessful():
self.driver.get_screenshot_as_file(f"failed_test_shot_logoutgreetertest_{self.id()}.png")
def assertStdOutLine(self, expected):
out, err = self.proc.communicate()
outLines = out.splitlines()
self.assertEqual(expected, outLines[(len(outLines) - 1)].decode('UTF-8'))
def test_sleep(self):
self.driver.find_element(AppiumBy.XPATH, "//button[contains(@name, 'Slee') and contains(@accessibility-id, 'LogoutButton')]").click()
self.assertStdOutLine("suspend")
def test_hibernate(self):
self.driver.find_element(AppiumBy.XPATH, "//button[contains(@name, 'Hibernate') and contains(@accessibility-id, 'LogoutButton')]").click()
self.assertStdOutLine("hibernate")
def test_restart(self):
self.driver.find_element(AppiumBy.XPATH, "//button[contains(@name, 'Restart') and contains(@accessibility-id, 'LogoutButton')]").click()
self.assertStdOutLine("reboot")
def test_shutdown(self):
self.driver.find_element(AppiumBy.XPATH, "//button[contains(@name, 'Shut Down') and contains(@accessibility-id, 'LogoutButton')]").click()
self.assertStdOutLine("shutdown")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import PlasmaAppletTest
WIDGET_ID: Final = "org.kde.plasma.manage-inputmethod"
class ManageInputMethodTest(PlasmaAppletTest):
"""
Tests for the Input Method widget
"""
widget_id = WIDGET_ID
extra_environ = {
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false;qt.qml.propertyCache.append.warning=false",
}
def test_0_open(self) -> None:
"""
Tests the widget can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Input Method")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,2 @@
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: GPL-2.0-or-later
@@ -0,0 +1,523 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2019 The GNOME Music developers
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: GPL-2.0-or-later
# pylint: disable=too-many-arguments
# For FreeBSD CI which only has python 3.9
from __future__ import annotations
import argparse
import logging
import json
import os
import signal
import sys
import threading
import time
from os import getpid
from typing import Any, Final
current_folder: Final = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(current_folder, os.pardir, os.pardir, "utils"))
from gi.repository import Gio, GLib
from GLibMainLoopThread import GLibMainLoopThread
def read_player_metadata(json_dict: dict[str, Any]) -> list[dict[str, GLib.Variant]]:
song_list: list[dict[str, int | str | list[str]]] = json_dict["metadata"]
assert len(song_list) > 0
_metadata: list[dict[str, GLib.Variant]] = []
for song in song_list:
song_dict: dict[str, GLib.Variant] = {
"mpris:trackid": GLib.Variant('o', song["mpris:trackid"]),
"xesam:url": GLib.Variant('s', "file://" + os.path.join(current_folder, song["xesam:url"])),
"mpris:length": GLib.Variant('x', int(song["mpris:length"])), # ms
"xesam:title": GLib.Variant('s', song["xesam:title"]),
"xesam:artist": GLib.Variant('as', song["xesam:artist"]),
"mpris:artUrl": GLib.Variant('s', "")
}
if "xesam:album" in song.keys():
song_dict["xesam:album"] = GLib.Variant('s', song["xesam:album"])
if "mpris:artUrl" in song.keys():
song_dict["mpris:artUrl"] = GLib.Variant('s', "file://" + os.path.join(current_folder, song["mpris:artUrl"]))
if "kde:pid" in song.keys():
song_dict["kde:pid"] = GLib.Variant('u', song["kde:pid"])
_metadata.append(song_dict)
return _metadata
def read_base_properties(json_dict: dict[str, Any]) -> dict[str, GLib.Variant]:
prop_dict: dict[str, bool | str | list[str]] = json_dict["base_properties"]
assert len(prop_dict) > 0
_base_properties: dict[str, GLib.Variant] = {
"CanQuit": GLib.Variant('b', prop_dict["CanQuit"]),
"Fullscreen": GLib.Variant('b', prop_dict["Fullscreen"]),
"CanSetFullscreen": GLib.Variant('b', prop_dict["CanSetFullscreen"]),
"CanRaise": GLib.Variant('b', prop_dict["CanRaise"]),
"HasTrackList": GLib.Variant('b', prop_dict["HasTrackList"]),
"Identity": GLib.Variant('s', prop_dict["Identity"]),
"DesktopEntry": GLib.Variant('s', prop_dict["DesktopEntry"]),
"SupportedUriSchemes": GLib.Variant('as', prop_dict["SupportedUriSchemes"]),
"SupportedMimeTypes": GLib.Variant('as', prop_dict["SupportedMimeTypes"]),
}
return _base_properties
def read_player_properties(json_dict: dict[str, Any], _metadata: dict[str, GLib.Variant]) -> dict[str, GLib.Variant]:
prop_dict: dict[str, int | float | bool | str | dict] = json_dict["player_properties"]
assert len(prop_dict) > 0
_player_properties: dict[str, GLib.Variant] = {
"PlaybackStatus": GLib.Variant("s", prop_dict["PlaybackStatus"]),
"LoopStatus": GLib.Variant("s", prop_dict["LoopStatus"]),
"Rate": GLib.Variant("d", prop_dict["Rate"]),
"Shuffle": GLib.Variant("b", prop_dict["Shuffle"]),
"Metadata": GLib.Variant("a{sv}", _metadata),
"Position": GLib.Variant("x", prop_dict["Position"]),
"MinimumRate": GLib.Variant("d", prop_dict["MinimumRate"]),
"MaximumRate": GLib.Variant("d", prop_dict["MaximumRate"]),
"Volume": GLib.Variant("d", prop_dict["Volume"]),
"CanGoNext": GLib.Variant("b", prop_dict["CanGoNext"]),
"CanGoPrevious": GLib.Variant("b", prop_dict["CanGoPrevious"]),
"CanPlay": GLib.Variant("b", prop_dict["CanPlay"]),
"CanPause": GLib.Variant("b", prop_dict["CanPause"]),
"CanSeek": GLib.Variant("b", prop_dict["CanSeek"]),
"CanControl": GLib.Variant("b", prop_dict["CanControl"]),
}
return _player_properties
class Mpris2:
"""
MPRIS2 interface implemented in GDBus, since dbus-python does not support property
"""
BASE_IFACE: Final = "org.mpris.MediaPlayer2"
OBJECT_PATH: Final = "/org/mpris/MediaPlayer2"
PLAYER_IFACE: Final = GLib.Variant('s', "org.mpris.MediaPlayer2.Player")
APP_INTERFACE: Final = f"org.mpris.MediaPlayer2.appiumtest.instance{str(getpid())}"
connection: Gio.DBusConnection | None = None
def __init__(self, metadata: list[dict[str, GLib.Variant]], base_properties: dict[str, GLib.Variant], player_properties: dict[str, GLib.Variant], current_index: int) -> None:
self.metadata: list[dict[str, GLib.Variant]] = metadata
self.base_properties: dict[str, GLib.Variant] = base_properties
self.player_properties: dict[str, GLib.Variant] = player_properties
self.current_index: int = current_index
self.registered_event = threading.Event()
self.playback_status_set_event = threading.Event()
self.metadata_updated_event = threading.Event()
self.__owner_id: int = Gio.bus_own_name(Gio.BusType.SESSION, self.APP_INTERFACE, Gio.BusNameOwnerFlags.NONE, self.on_bus_acquired, None, None)
assert self.__owner_id > 0
self.__prop_reg_id: int = 0
self.__player_reg_id: int = 0
self.__base_reg_id: int = 0
def quit(self) -> None:
if self.connection is None:
return
self.connection.unregister_object(self.__prop_reg_id)
self.__prop_reg_id = 0
self.connection.unregister_object(self.__player_reg_id)
self.__player_reg_id = 0
self.connection.unregister_object(self.__base_reg_id)
self.__base_reg_id = 0
Gio.bus_unown_name(self.__owner_id)
self.connection.flush_sync(None)
sync_event = threading.Event()
GLib.idle_add(lambda: sync_event.set() or False)
sync_event.wait(timeout=3.0)
self._wait_for_dbus_name_released()
logging.info("Player exit")
def _wait_for_dbus_name_released(self, timeout: float = 5.0) -> None:
"""Wait for a D-Bus name to be released."""
bus_name = self.APP_INTERFACE
session_bus = Gio.bus_get_sync(Gio.BusType.SESSION)
deadline = time.time() + timeout
while time.time() < deadline:
result = session_bus.call_sync("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameHasOwner", GLib.Variant("(s)", (bus_name, )), None, Gio.DBusSendMessageFlags.NONE, 100, None)
if not result[0]:
return
time.sleep(0.1)
def on_bus_acquired(self, connection: Gio.DBusConnection, name: str, *args) -> None:
"""
Interface is ready, now register objects.
"""
self.connection = connection
dbus_folder: str = os.path.join(current_folder, os.pardir, os.pardir, os.pardir, "libkmpris", "dbus")
with open(f"{dbus_folder}/org.freedesktop.DBus.Properties.xml", encoding="utf-8") as handler:
properties_introspection_xml: str = '\n'.join(handler.readlines())
introspection_data = Gio.DBusNodeInfo.new_for_xml(properties_introspection_xml)
self.__prop_reg_id = connection.register_object(self.OBJECT_PATH, introspection_data.interfaces[0], self.properties_handle_method_call, None, None)
assert self.__prop_reg_id > 0
with open(f"{dbus_folder}/org.mpris.MediaPlayer2.Player.xml", encoding="utf-8") as handler:
player_introspection_xml: str = '\n'.join(handler.readlines())
introspection_data = Gio.DBusNodeInfo.new_for_xml(player_introspection_xml)
self.__player_reg_id = connection.register_object(self.OBJECT_PATH, introspection_data.interfaces[0], self.player_handle_method_call, self.player_handle_get_property, self.player_handle_set_property)
assert self.__player_reg_id != 0
with open(f"{dbus_folder}/org.mpris.MediaPlayer2.xml", encoding="utf-8") as handler:
interface_introspection_xml: str = '\n'.join(handler.readlines())
introspection_data = Gio.DBusNodeInfo.new_for_xml(interface_introspection_xml)
self.__base_reg_id = connection.register_object(self.OBJECT_PATH, introspection_data.interfaces[0], self.interface_handle_method_call, self.interface_handle_get_property, self.interface_handle_set_property)
assert self.__base_reg_id != 0
print("MPRIS registered", file=sys.stderr, flush=True)
self.registered_event.set()
def properties_handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
"""
Handles method calls for org.freedesktop.DBus.Properties
"""
assert interface_name == "org.freedesktop.DBus.Properties", f"Wrong interface name {interface_name} from {sender}"
if method_name == "Get":
ret: Any = None
interface: str = parameters[0]
property_name: str = parameters[1]
if interface == self.BASE_IFACE:
ret = self.base_properties[property_name]
elif interface == self.PLAYER_IFACE.get_string():
ret = self.player_properties[property_name]
else:
assert False, f"Unknown interface {interface}"
print(f"Get: {interface} {property_name} {ret}", file=sys.stderr, flush=True)
invocation.return_value(GLib.Variant.new_tuple(GLib.Variant('v', ret)))
elif method_name == "GetAll":
interface = parameters[0]
if interface == self.BASE_IFACE:
ret = GLib.Variant('a{sv}', self.base_properties)
elif interface == self.PLAYER_IFACE.get_string():
ret = GLib.Variant('a{sv}', self.player_properties)
else:
assert False, f"Unknown interface {interface}"
print(f"GetAll: {interface} {ret}", file=sys.stderr, flush=True)
invocation.return_value(GLib.Variant.new_tuple(ret))
elif method_name == "Set":
interface = parameters[0]
property_name = parameters[1]
value: Any = parameters[2]
if interface != self.PLAYER_IFACE.get_string():
assert False, f"Wrong interface {interface}"
if property_name == "Rate":
self.set_rate(value, connection, object_path)
elif property_name == "LoopStatus":
self.set_repeat(value, connection, object_path)
elif property_name == "Shuffle":
self.set_shuffle(value, connection, object_path)
elif property_name == "Volume":
self.set_volume(value, connection, object_path)
else:
assert False, f"Unknown property {property_name}"
print(f"Set: {interface} {property_name} {value}", file=sys.stderr, flush=True)
else:
logging.error("Unhandled method: %s", method_name)
invocation.return_error_literal(Gio.dbus_error_quark(), Gio.DBusError.UNKNOWN_METHOD, f"Unknown method {method_name}")
def set_playing(self, playing: bool, connection: Gio.DBusConnection, object_path: str) -> None:
"""
Changes the playing state
"""
self.player_properties["PlaybackStatus"] = GLib.Variant('s', "Playing" if playing else "Paused")
changed_properties = GLib.Variant('a{sv}', {
"PlaybackStatus": self.player_properties["PlaybackStatus"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
self.playback_status_set_event.set()
def stop(self, connection: Gio.DBusConnection, object_path: str) -> None:
"""
Changes the playing state
"""
self.player_properties["PlaybackStatus"] = GLib.Variant('s', "Stopped")
self.player_properties["Metadata"] = GLib.Variant('a{sv}', {})
changed_properties = GLib.Variant('a{sv}', {
"PlaybackStatus": self.player_properties["PlaybackStatus"],
"Metadata": self.player_properties["Metadata"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
def set_rate(self, rate: float, connection: Gio.DBusConnection, object_path: str) -> None:
"""
Changes the shuffle state
"""
assert isinstance(rate, float), f"argument is not a float but {type(rate)}"
assert self.player_properties["MinimumRate"].get_double() <= rate <= self.player_properties["MaximumRate"].get_double(), f"Rate {rate} is out of bounds"
self.player_properties["Rate"] = GLib.Variant('d', rate)
changed_properties = GLib.Variant('a{sv}', {
"Rate": self.player_properties["Rate"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
def set_shuffle(self, shuffle: bool, connection: Gio.DBusConnection, object_path: str) -> None:
"""
Changes the shuffle state
"""
assert isinstance(shuffle, bool), f"argument is not a boolean but {type(shuffle)}"
self.player_properties["Shuffle"] = GLib.Variant('b', shuffle)
changed_properties = GLib.Variant('a{sv}', {
"Shuffle": self.player_properties["Shuffle"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
def set_repeat(self, repeat: str, connection: Gio.DBusConnection, object_path: str) -> None:
"""
Changes the loop state
"""
assert isinstance(repeat, str), f"argument is not a string but {type(repeat)}"
self.player_properties["LoopStatus"] = GLib.Variant('s', repeat)
changed_properties = GLib.Variant('a{sv}', {
"LoopStatus": self.player_properties["LoopStatus"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
def set_volume(self, volume: float, connection: Gio.DBusConnection, object_path: str) -> None:
"""
Adjusts the volume
"""
assert isinstance(volume, float) and 0 <= volume <= 1, f"Invalid volume {volume} of type {type(volume)}"
self.player_properties["Volume"] = GLib.Variant('d', volume)
changed_properties = GLib.Variant('a{sv}', {
"Volume": self.player_properties["Volume"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
def player_handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
"""
Handles method calls for org.mpris.MediaPlayer2.Player
"""
assert interface_name == "org.mpris.MediaPlayer2.Player", f"Wrong interface name {interface_name} from {sender}"
print(f"player_handle_method_call method_name: {method_name}", file=sys.stderr, flush=True)
if method_name == "Next" or method_name == "Previous":
self.current_index += 1 if method_name == "Next" else -1
assert 0 <= self.current_index < len(self.metadata)
self.player_properties["Metadata"] = GLib.Variant('a{sv}', self.metadata[self.current_index])
self.player_properties["CanGoPrevious"] = GLib.Variant('b', self.current_index > 0)
self.player_properties["CanGoNext"] = GLib.Variant('b', self.current_index < len(self.metadata) - 1)
changed_properties = GLib.Variant('a{sv}', {
"Metadata": self.player_properties["Metadata"],
"CanGoPrevious": self.player_properties["CanGoPrevious"],
"CanGoNext": self.player_properties["CanGoNext"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
self.metadata_updated_event.set()
elif method_name == "Pause":
self.set_playing(False, connection, object_path)
elif method_name == "PlayPause":
self.set_playing(self.player_properties["PlaybackStatus"].get_string() != "Playing", connection, object_path)
elif method_name == "Stop":
self.stop(connection, object_path)
elif method_name == "Play":
self.set_playing(True, connection, object_path)
elif method_name == "Seek":
offset: int = parameters[0]
length: int = int(self.metadata[self.current_index]["mpris:length"])
position: int = self.player_properties["Position"].get_int64()
assert 0 <= position + offset <= length
self.player_properties["Position"] = GLib.Variant('x', position + offset)
changed_properties = GLib.Variant('a{sv}', {
'Position': self.player_properties["Position"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, self.PLAYER_IFACE.get_string(), "Seeked", GLib.Variant.new_tuple(self.player_properties["Position"]))
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
elif method_name == "SetPosition":
assert parameters[0] == self.metadata[self.current_index]["mpris:trackid"].get_string(), f"expected trackid: {parameters[0]}, actual trackid: {self.metadata[self.current_index]['mpris:trackid'].get_string()}"
self.player_properties["Position"] = GLib.Variant('x', parameters[1])
changed_properties = GLib.Variant('a{sv}', {
'Position': self.player_properties["Position"],
})
Gio.DBusConnection.emit_signal(connection, None, object_path, "org.freedesktop.DBus.Properties", "PropertiesChanged", GLib.Variant.new_tuple(self.PLAYER_IFACE, changed_properties, GLib.Variant('as', ())))
elif method_name == "OpenUri":
print("OpenUri", file=sys.stderr, flush=True)
else:
# In case the interface adds new methods, fail here for easier discovery
logging.error("%s does not exist", method_name)
invocation.return_error_literal(Gio.dbus_error_quark(), Gio.DBusError.NOT_SUPPORTED, f"Invalid method {method_name}")
def player_handle_get_property(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, value: Any):
"""
Handles properties for org.mpris.MediaPlayer2.Player
"""
assert interface_name == "org.mpris.MediaPlayer2.Player", f"Wrong interface name {interface_name} from {sender}"
assert value in self.player_properties.keys(), f"{value} does not exist"
return self.player_properties[value]
def player_handle_set_property(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, key: str, value: Any) -> bool:
"""
Handles properties for org.mpris.MediaPlayer2.Player
"""
assert interface_name == "org.mpris.MediaPlayer2.Player", f"Wrong interface name {interface_name} from {sender}"
assert key in self.player_properties.keys(), f"{key} does not exist"
print(f"player_handle_set_property key: {key}, value: {value}", file=sys.stderr, flush=True)
if key == "Rate":
self.set_rate(value, connection, object_path)
elif key == "LoopStatus":
self.set_repeat(value, connection, object_path)
elif key == "Shuffle":
self.set_shuffle(value, connection, object_path)
elif key == "Volume":
self.set_volume(value, connection, object_path)
else:
return False
# What is the correct thing to return here on success? It appears that
# we need to return something other than None or what would be evaluated
# to False for this call back to be successful.
return True
def interface_handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
"""
Handles method calls for org.mpris.MediaPlayer2
"""
assert interface_name == "org.mpris.MediaPlayer2", f"Wrong interface name {interface_name} from {sender}"
if method_name == "Raise":
print("Raise", file=sys.stderr, flush=True)
elif method_name == "Quit":
print("Quit", file=sys.stderr, flush=True)
else:
logging.error("%s does not exist", method_name)
invocation.return_error_literal(Gio.dbus_error_quark(), Gio.DBusError.NOT_SUPPORTED, f"Invalid method {method_name}")
def interface_handle_get_property(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, value: Any):
"""
Handles properties for org.mpris.MediaPlayer2
"""
assert interface_name == "org.mpris.MediaPlayer2", f"Wrong interface name {interface_name} from {sender}"
assert value in self.base_properties.keys(), f"{value} does not exist"
return self.base_properties[value]
def interface_handle_set_property(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, key: str, value: Any) -> bool:
"""
Handles properties for org.mpris.MediaPlayer2
"""
assert interface_name == "org.mpris.MediaPlayer2", f"Wrong interface name {interface_name} from {sender}"
assert key in self.base_properties.keys(), f"{key} does not exist"
return True
class InvalidMpris2(Mpris2):
"""
MPRIS2 interfaces with invalid responses
"""
APP_INTERFACE: Final = f"org.mpris.MediaPlayer2.appiumtest_invalid.instance{str(getpid())}"
def __init__(self) -> None:
super().__init__([], {}, {}, 0)
def properties_handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
"""
@override
"""
invocation.return_error_literal(Gio.dbus_error_quark(), Gio.DBusError.NOT_SUPPORTED, "")
def player_handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
"""
@override
"""
invocation.return_error_literal(Gio.dbus_error_quark(), Gio.DBusError.NOT_SUPPORTED, "")
def player_handle_get_property(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, value: Any):
"""
@override
"""
return None
def player_handle_set_property(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, key: str, value: Any) -> bool:
"""
@override
"""
return False
def interface_handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
"""
@override
"""
invocation.return_error_literal(Gio.dbus_error_quark(), Gio.DBusError.NOT_SUPPORTED, "")
def interface_handle_get_property(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, value: Any):
"""
@override
"""
return None
def interface_handle_set_property(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, key: str, value: Any) -> bool:
"""
@override
"""
return False
player: Mpris2
loopThread: GLibMainLoopThread
def __on_terminate(signal, frame) -> None:
player.quit()
loopThread.quit()
if loopThread.is_alive():
loopThread.join(timeout=10)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="MPRIS2 media player for testing")
parser.add_argument("json_path", nargs="?", help="Path to JSON file with player metadata")
parser.add_argument("--invalid", action="store_true", help="Start an invalid player for error testing")
parser.add_argument("--start-index", type=int, default=0, help="Starting track index")
args = parser.parse_args()
signal.signal(signal.SIGTERM, __on_terminate)
loopThread = GLibMainLoopThread()
loopThread.start()
if args.invalid:
player = InvalidMpris2()
logging.info("Invalid player started")
else:
if not args.json_path:
parser.error("json_path is required when not using --invalid")
with open(args.json_path, "r", encoding="utf-8") as f:
json_dict: dict[str, list | dict] = json.load(f)
metadata: list[dict[str, GLib.Variant]] = read_player_metadata(json_dict)
base_properties: dict[str, GLib.Variant] = read_base_properties(json_dict)
current_index: int = args.start_index
player_properties: dict[str, GLib.Variant] = read_player_properties(json_dict, metadata[current_index])
player = Mpris2(metadata, base_properties, player_properties, current_index)
logging.info("Player %s started", base_properties['Identity'].get_string())
@@ -0,0 +1,71 @@
{
"base_properties": {
"CanQuit": true,
"Fullscreen": false,
"CanSetFullscreen": false,
"CanRaise": true,
"HasTrackList": true,
"Identity": "AppiumTest",
"DesktopEntry": "appiumtest",
"SupportedUriSchemes": [
"file"
],
"SupportedMimeTypes": [
"application/ogg"
]
},
"player_properties": {
"PlaybackStatus": "Stopped",
"LoopStatus": "None",
"Rate": 1.0,
"Shuffle": false,
"Metadata": {},
"Position": 0,
"MinimumRate": 1.0,
"MaximumRate": 1.0,
"Volume": 1.0,
"CanGoNext": true,
"CanGoPrevious": true,
"CanPlay": true,
"CanPause": true,
"CanSeek": true,
"CanControl": true
},
"metadata": [
{
"mpris:trackid": "/appiumtest/2",
"xesam:url": "media0.mp3",
"mpris:length": 600000000,
"xesam:title": "Katie's Favorite",
"xesam:album": "The Best of Konqi",
"xesam:artist": [
"KDE Community"
],
"mpris:artUrl": "mediacontrollertests_art0.png"
},
{
"mpris:trackid": "/appiumtest/1",
"xesam:url": "media1.mp3",
"mpris:length": 300000000,
"xesam:title": "Konqi ❤️ Katie",
"xesam:album": "The Best of Konqi",
"xesam:artist": [
"KDE Community",
"La communauté KDE"
],
"mpris:artUrl": "mediacontrollertests_art1.png"
},
{
"mpris:trackid": "/appiumtest/2",
"xesam:url": "media2.mp3",
"mpris:length": 900000000,
"xesam:title": "Konqi's Favorite",
"xesam:album": "The Best of Konqi",
"xesam:artist": [
"KDE Community",
"KDE 社区"
],
"mpris:artUrl": "mediacontrollertests_art2.png"
}
]
}
@@ -0,0 +1,47 @@
{
"base_properties": {
"CanQuit": true,
"Fullscreen": false,
"CanSetFullscreen": false,
"CanRaise": true,
"HasTrackList": true,
"Identity": "Audacious",
"DesktopEntry": "audacious",
"SupportedUriSchemes": [
"file"
],
"SupportedMimeTypes": [
"application/ogg"
]
},
"player_properties": {
"PlaybackStatus": "Stopped",
"LoopStatus": "None",
"Rate": 1.0,
"Shuffle": false,
"Metadata": {},
"Position": 0,
"MinimumRate": 1.0,
"MaximumRate": 1.0,
"Volume": 1.0,
"CanGoNext": false,
"CanGoPrevious": false,
"CanPlay": true,
"CanPause": true,
"CanSeek": true,
"CanControl": true
},
"metadata": [
{
"mpris:trackid": "/audacious/1",
"xesam:url": "Clarinet Quintet.ogg",
"mpris:length": 900000000,
"xesam:title": "Clarinet Quintet",
"xesam:album": "Mozart",
"xesam:artist": [
"Mozart"
],
"mpris:artUrl": "mediacontrollertests_art0.png"
}
]
}
@@ -0,0 +1,45 @@
{
"base_properties": {
"CanQuit": true,
"Fullscreen": false,
"CanSetFullscreen": false,
"CanRaise": true,
"HasTrackList": true,
"Identity": "Firefox",
"DesktopEntry": "firefox",
"SupportedUriSchemes": [
"file"
],
"SupportedMimeTypes": [
"application/ogg"
]
},
"player_properties": {
"PlaybackStatus": "Stopped",
"LoopStatus": "None",
"Rate": 1.0,
"Shuffle": false,
"Metadata": {},
"Position": 0,
"MinimumRate": 1.0,
"MaximumRate": 1.0,
"Volume": 1.0,
"CanGoNext": false,
"CanGoPrevious": false,
"CanPlay": true,
"CanPause": true,
"CanSeek": false,
"CanControl": true
},
"metadata": [
{
"mpris:trackid": "/firefox/1",
"xesam:url": "Clarinet Quintet.ogg",
"mpris:length": 900000000,
"xesam:title": "Browser without p-b-i",
"xesam:album": "Browser",
"xesam:artist": [],
"mpris:artUrl": "mediacontrollertests_art0.png"
}
]
}
@@ -0,0 +1,59 @@
{
"base_properties": {
"CanQuit": true,
"Fullscreen": false,
"CanSetFullscreen": false,
"CanRaise": true,
"HasTrackList": true,
"Identity": "Mozilla Firefox",
"DesktopEntry": "chromium-browser",
"SupportedUriSchemes": [
"file"
],
"SupportedMimeTypes": [
"application/ogg"
]
},
"player_properties": {
"PlaybackStatus": "Stopped",
"LoopStatus": "None",
"Rate": 1.0,
"Shuffle": false,
"Metadata": {},
"Position": 0,
"MinimumRate": 1.0,
"MaximumRate": 1.0,
"Volume": 1.0,
"CanGoNext": true,
"CanGoPrevious": false,
"CanPlay": true,
"CanPause": true,
"CanSeek": true,
"CanControl": true
},
"metadata": [
{
"mpris:trackid": "/firefox/1",
"xesam:url": "Clarinet Quintet.ogg",
"mpris:length": 900000000,
"xesam:title": "Browser with p-b-i",
"xesam:album": "浏览器",
"xesam:artist": [
"ABC",
"DEF"
],
"mpris:artUrl": "mediacontrollertests_art0.png",
"kde:pid": 0
},
{
"mpris:trackid": "/firefox/2",
"xesam:url": "Clarinet Quintet.ogg",
"mpris:length": 900000000,
"xesam:title": "Browser with p-b-i 2",
"xesam:album": "浏览器",
"xesam:artist": [],
"mpris:artUrl": "mediacontrollertests_art1.png",
"kde:pid": 0
}
]
}
@@ -0,0 +1,43 @@
{
"base_properties": {
"CanQuit": true,
"Fullscreen": false,
"CanSetFullscreen": false,
"CanRaise": true,
"HasTrackList": true,
"Identity": "PlayerWithEncodedUrl",
"DesktopEntry": "audacious",
"SupportedUriSchemes": [
"file"
],
"SupportedMimeTypes": [
"application/ogg"
]
},
"player_properties": {
"PlaybackStatus": "Stopped",
"LoopStatus": "None",
"Rate": 1.0,
"Shuffle": false,
"Metadata": {},
"Position": 0,
"MinimumRate": 1.0,
"MaximumRate": 1.0,
"Volume": 1.0,
"CanGoNext": false,
"CanGoPrevious": false,
"CanPlay": true,
"CanPause": true,
"CanSeek": false,
"CanControl": true
},
"metadata": [
{
"mpris:trackid": "/audacious/1",
"xesam:url": "file:///mnt/data/Music/League%20of%20Legends/Flash%20Funk%20marshmallow%20remix.ogg",
"mpris:length": 2160000000,
"xesam:title": "Flash Funk",
"xesam:artist": []
}
]
}
@@ -0,0 +1,64 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2025 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import sys
from jobnotificationinterface import JobNotificationControlInterface
from KCoreAddons import KJob
from KJobWidgets import KUiServerV2JobTracker
from PySide6.QtCore import QCoreApplication, QMetaObject, Qt, QTimer
from PySide6.QtGui import QGuiApplication
class TestJob(KJob):
def __init__(self) -> None:
super().__init__()
self.setProperty("immediateProgressReporting", True)
self.setCapabilities(KJob.Capability.Killable | KJob.Capability.Suspendable)
def start(self) -> None:
# Delay reporting total bytes to test BUG 501991
self.startElapsedTimer()
QTimer.singleShot(500, self, self.init_progress)
def doKill(self) -> bool:
QMetaObject.invokeMethod(QCoreApplication.instance(), "quit", Qt.QueuedConnection)
return True
def doSuspend(self) -> bool:
return True
def doResume(self) -> bool:
return True
def init_progress(self) -> None:
self.setProperty("destUrl", "file:///home/foobar/test.txt")
self.setTotalAmount(KJob.Unit.Bytes, 1024 * 1024 * 10)
self.setProcessedAmount(KJob.Unit.Bytes, 1024 * 1024 * 1)
self.setTotalAmount(KJob.Unit.Files, 1)
def update_progress(self, new_bytes: int) -> None:
if new_bytes > self.processedAmount(KJob.Unit.Bytes):
self.emitSpeed(new_bytes - self.processedAmount(KJob.Unit.Bytes))
self.setProcessedAmount(KJob.Unit.Bytes, new_bytes)
if self.processedAmount(KJob.Unit.Bytes) == self.totalAmount(KJob.Unit.Bytes):
self.emitResult()
if __name__ == "__main__":
app = QGuiApplication(sys.argv)
app.setDesktopFileName("org.kde.plasmashell")
tracker = KUiServerV2JobTracker(app)
job = TestJob()
job.finished.connect(app.quit)
tracker.registerJob(job)
job.start()
control_interface = JobNotificationControlInterface(job)
sys.exit(app.exec())
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2025 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
from typing import Final
from gi.repository import Gio, GLib
class JobNotificationControlInterface:
BUS_NAME: Final = "org.kde.jobnotificationtest"
OBJECT_PATH: Final = "/jobnotificationtest"
connection: Gio.DBusConnection
pid: int
def __init__(self, job) -> None:
self.reg_id: int = 0
self.owner_id: int = Gio.bus_own_name(Gio.BusType.SESSION, self.BUS_NAME, Gio.BusNameOwnerFlags.NONE, self.on_bus_acquired, None, None)
assert self.owner_id > 0
self.job = job
def quit(self) -> None:
self.connection.unregister_object(self.reg_id)
Gio.bus_unown_name(self.owner_id)
self.connection.flush_sync(None)
def on_bus_acquired(self, connection: Gio.DBusConnection, name: str, *args) -> None:
self.connection = connection
introspection_data = Gio.DBusNodeInfo.new_for_xml("""
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.jobnotificationtest">
<method name="SetProcessedAmount">
<arg name="ProcessedAmount" type="t" direction="in"/>
</method>
</interface>
</node>
""")
self.reg_id = connection.register_object(self.OBJECT_PATH, introspection_data.interfaces[0], self.handle_method_call, None, None)
assert self.reg_id > 0
def handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
if method_name == "SetProcessedAmount":
self.job.update_progress(parameters[0])
else:
invocation.return_error_literal(Gio.dbus_error_quark(), Gio.DBusError.UNKNOWN_METHOD, f"Unknown method {method_name}")
return
invocation.return_value(None)
@@ -0,0 +1,538 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import base64
import logging
import os
import queue
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import threading
import time
import unittest
from datetime import date
from time import sleep
from typing import IO, Final
import cv2 as cv
import gi
import numpy as np
gi.require_version("Gdk", "3.0") # StatusIcon is removed in 4
gi.require_version("Gtk", "3.0") # StatusIcon is removed in 4
gi.require_version('GdkPixbuf', '2.0')
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
from gi.repository import Gdk, GdkPixbuf, Gio, GLib, Gtk
from selenium.common.exceptions import TimeoutException, WebDriverException
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.actions.action_builder import ActionBuilder
from selenium.webdriver.common.actions.interaction import POINTER_MOUSE
from selenium.webdriver.common.actions.mouse_button import MouseButton
from selenium.webdriver.common.actions.pointer_input import PointerInput
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
KDE_VERSION: Final = 6
WIDGET_ID: Final = "org.kde.plasma.systemtray"
CMAKE_RUNTIME_OUTPUT_DIRECTORY: Final = os.getenv("CMAKE_RUNTIME_OUTPUT_DIRECTORY", os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, "build", "bin"))
def generate_color_block(red: int, green: int, blue: int) -> str:
cv_second_image = np.zeros((10, 10, 3), dtype=np.uint8)
cv_second_image[:, :] = [blue, green, red]
return base64.b64encode(cv.imencode('.png', cv_second_image)[1].tobytes()).decode()
class XEmbedTrayIcon(threading.Thread):
"""
XEmbed tray icon implementation using Gtk.StatusIcon
"""
def __init__(self, title: str) -> None:
super().__init__()
GLib.timeout_add_seconds(300, Gtk.main_quit) # Failsafe
# Red square
self.__status_icon: Gtk.StatusIcon = Gtk.StatusIcon(title=title)
pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 16, 16)
pixbuf.fill(0xaa0000ff) # 170, 0, 0
self.__status_icon.set_from_pixbuf(pixbuf)
self.__status_icon.connect("button-press-event", self._on_button_press_event)
self.button_press_event = threading.Event()
self.pressed_button: int = -1
self.__status_icon.connect("button-release-event", self._on_button_release_event)
self.button_release_event = threading.Event()
self.__status_icon.connect("popup-menu", self._on_popup_menu)
self.popup_menu_event = threading.Event()
self.scroll_event = threading.Event()
self.__status_icon.connect("scroll-event", self._on_scroll_event)
def run(self) -> None:
Gtk.main()
def quit(self) -> None:
Gtk.main_quit()
def reset_events(self) -> None:
"""
Reset all threading events
"""
self.button_press_event.clear()
self.pressed_button = -1
self.button_release_event.clear()
self.popup_menu_event.clear()
self.scroll_event.clear()
def _on_button_press_event(self, status_icon: Gtk.StatusIcon, button_event: Gdk.EventButton) -> None:
logging.info(f"button-press-event {button_event.button}")
self.pressed_button = button_event.button
self.button_press_event.set()
def _on_button_release_event(self, status_icon: Gtk.StatusIcon, button_event: Gdk.EventButton) -> None:
logging.info(f"button-release-event {button_event.button}")
self.button_release_event.set()
def _on_popup_menu(self, status_icon: Gtk.StatusIcon, button: int, activate_time: int) -> None:
logging.info(f"popup-menu {button} {activate_time}")
self.popup_menu_event.set()
def _on_scroll_event(self, status_icon, scroll_event: Gdk.EventScroll) -> None:
logging.info(f"scroll-event {scroll_event.delta_x} {scroll_event.delta_y} {int(scroll_event.direction)}")
self.scroll_event.set()
class StreamReaderThread(threading.Thread):
"""
Non-blocking readline thread
"""
def __init__(self, stream: IO[bytes]) -> None:
"""
@param stream: the stream to read from
"""
self.__stream: IO[bytes] = stream
self.__queue = queue.Queue()
self.__stop_event = threading.Event()
# Create the thread
super().__init__()
def run(self) -> None:
"""
Collects lines from the source stream and put them in the queue.
"""
while self.__stream.readable() and not self.__stop_event.is_set():
line_str: str = self.__stream.readline().decode(encoding="utf-8")
if "Received click" in line_str:
self.__queue.put(line_str)
elif len(line_str) == 0:
break
def stop(self) -> None:
"""
Stops the thread
"""
self.__stop_event.set()
def readline(self) -> str | None:
"""
Non-blocking readline
The default timeout is 5s.
"""
try:
return self.__queue.get(block=True, timeout=5)
except queue.Empty:
return None
class SystemTrayTests(unittest.TestCase):
"""
Tests for the system tray widget
"""
driver: webdriver.Remote
xembedsniproxy: subprocess.Popen[bytes] | None = None
kded: subprocess.Popen[bytes] | None = None
xembed_tray_icon: XEmbedTrayIcon | None = None
stream_reader_thread: StreamReaderThread | None = None
@classmethod
def setUpClass(cls) -> None:
"""
Opens the widget and initialize the webdriver
"""
# Install the test widget
os.makedirs(os.path.join(GLib.get_user_data_dir(), "plasma", "plasmoids"))
shutil.copytree(os.path.join(os.path.dirname(os.path.abspath(__file__)), "systemtraytest", "org.kde.testdbusactivation"), os.path.join(GLib.get_user_data_dir(), "plasma", "plasmoids", "org.kde.testdbusactivation"))
options = AppiumOptions()
options.set_capability("app", f"plasmawindowed -p org.kde.plasma.nano {WIDGET_ID}")
options.set_capability("environ", {
"LC_ALL": "en_US.UTF-8",
})
cls.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
cls.kded = subprocess.Popen([f"kded{KDE_VERSION}"])
# Doc: https://lazka.github.io/pgi-docs/Gio-2.0/classes/DBusConnection.html
session_bus: Gio.DBusConnection = Gio.bus_get_sync(Gio.BusType.SESSION)
SERVICE_NAME: Final = "org.freedesktop.DBus"
OBJECT_PATH: Final = "/"
INTERFACE_NAME: Final = SERVICE_NAME
message: Gio.DBusMessage = Gio.DBusMessage.new_method_call(SERVICE_NAME, OBJECT_PATH, INTERFACE_NAME, "NameHasOwner")
message.set_body(GLib.Variant("(s)", [f"org.kde.kded{KDE_VERSION}"]))
for _ in range(5):
reply, _ = session_bus.send_message_with_reply_sync(message, Gio.DBusSendMessageFlags.NONE, 1000)
if reply and reply.get_signature() == 'b' and reply.get_body().get_child_value(0).get_boolean():
break
print(f"waiting for kded to appear on the dbus session", file=sys.stderr, flush=True)
sleep(1)
kded_reply: GLib.Variant = session_bus.call_sync(f"org.kde.kded{KDE_VERSION}", "/kded", f"org.kde.kded{KDE_VERSION}", "loadModule", GLib.Variant("(s)", [f"statusnotifierwatcher"]), GLib.VariantType("(b)"), Gio.DBusSendMessageFlags.NONE, 1000)
assert kded_reply.get_child_value(0).get_boolean(), "Module is not loaded"
def setUp(self) -> None:
pass
def tearDown(self) -> None:
"""
Take screenshot when the current test fails
"""
if not self._outcome.result.wasSuccessful():
if os.environ.get("TEST_WITH_KWIN_WAYLAND", "1") == "0":
subprocess.check_call(["import", "-window", "root", f"failed_test_shot_systemtraytest_#{self.id()}.png"])
else:
self.driver.get_screenshot_as_file(f"failed_test_shot_systemtraytest_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
"""
Make sure to terminate the driver again, lest it dangles.
"""
subprocess.check_call([f"kquitapp{KDE_VERSION}", "plasmawindowed"])
for _ in range(10):
try:
subprocess.check_call(["pidof", "plasmawindowed"])
except subprocess.CalledProcessError:
break
time.sleep(1)
if cls.kded is not None:
subprocess.check_call([f"kquitapp{KDE_VERSION}", f"kded{KDE_VERSION}"])
cls.kded.wait(5)
cls.driver.quit()
def take_screenshot(self) -> str:
"""
Take screenshot of the current screen and use png+base64 to encode the image
"""
with tempfile.TemporaryDirectory() as temp_dir:
saved_image_path = os.path.join(temp_dir, "tray.png")
if os.getenv("TEST_WITH_KWIN_WAYLAND", "1") == "0":
subprocess.check_call(["import", "-window", "root", saved_image_path])
else:
self.driver.get_screenshot_as_file(saved_image_path)
cv_image = cv.imread(saved_image_path, cv.IMREAD_COLOR)
return base64.b64encode(cv.imencode('.png', cv_image)[1].tobytes()).decode()
def cleanup_xembed_tray_icon(self) -> None:
"""
Cleanup function for test_xembed_tray_icon
"""
if self.xembed_tray_icon is not None:
self.xembed_tray_icon.quit()
self.xembed_tray_icon = None
if self.xembedsniproxy is not None:
subprocess.check_call([f"kquitapp{KDE_VERSION}", "xembedsniproxy"])
self.xembedsniproxy.wait(5)
self.xembedsniproxy = None
if self.stream_reader_thread is not None and self.stream_reader_thread.is_alive():
self.stream_reader_thread.stop()
self.stream_reader_thread = None
def click_center(self, rect: dict[str, int], mouse_button: int = MouseButton.LEFT) -> None:
"""
Move the mouse to the center of the area and click
"""
if self.xembed_tray_icon is not None:
self.xembed_tray_icon.reset_events()
action = ActionBuilder(self.driver, mouse=PointerInput(POINTER_MOUSE, "mouse"))
action.pointer_action.move_to_location(int(rect["x"] + rect["width"] / 2), int(rect["y"] + rect["height"] / 2)).click(None, mouse_button).pause(1)
action.perform()
if self.xembed_tray_icon is None:
return
self.assertTrue(self.xembed_tray_icon.button_press_event.is_set())
self.assertTrue(self.xembed_tray_icon.button_release_event.is_set())
# the button which was pressed or released, numbered from 1 to 5. Normally button 1 is the left mouse button, 2 is the middle button, and 3 is the right button. On 2-button mice, the middle button can often be simulated by pressing both mouse buttons together.
if mouse_button == MouseButton.LEFT:
self.assertEqual(self.xembed_tray_icon.pressed_button, 1)
elif mouse_button == MouseButton.MIDDLE:
self.assertEqual(self.xembed_tray_icon.pressed_button, 2)
elif mouse_button == MouseButton.RIGHT:
self.assertEqual(self.xembed_tray_icon.pressed_button, 3)
def scroll_center(self, rect: dict[str, int], delta_x: float, delta_y: float) -> None:
"""
Move the mouse to the center of the area and scroll
"""
if self.xembed_tray_icon is not None:
self.xembed_tray_icon.reset_events()
action = ActionBuilder(self.driver)
action.wheel_action.scroll(int(rect["x"] + rect["width"] / 2), int(rect["y"] + rect["height"] / 2), delta_x, delta_y).pause(1)
action.perform()
if self.xembed_tray_icon is not None:
WebDriverWait(self.driver, 4).until(lambda _: self.xembed_tray_icon.scroll_event.is_set())
def test_1_xembed_tray_icon(self) -> None:
"""
Tests XEmbed tray icons can be listed and clicked in the tray.
@note GTK doesn't like send_events and double checks the mouse position
matches where the window is and is top level, so match the debug
output from xembedsniproxy instead.
"""
self.addCleanup(self.cleanup_xembed_tray_icon)
debug_env: dict[str, str] = os.environ.copy()
debug_env["QT_LOGGING_RULES"] = "kde.xembedsniproxy.debug=true"
debug_env["XDG_SESSION_TYPE"] = "x11" if os.getenv("TEST_WITH_KWIN_WAYLAND", "1") == "0" else "wayland"
self.xembedsniproxy = subprocess.Popen([os.path.join(CMAKE_RUNTIME_OUTPUT_DIRECTORY, "xembedsniproxy"), '--platform', 'xcb'], env=debug_env, stderr=subprocess.PIPE) # For debug output
if not self.xembedsniproxy.stderr or self.xembedsniproxy.poll() != None:
self.fail("xembedsniproxy is not available")
print(f"xembedsniproxy PID: {self.xembedsniproxy.pid}", file=sys.stderr, flush=True)
title: str = f"XEmbed Status Icon Test {date.today().strftime('%Y%m%d')}"
self.xembed_tray_icon = XEmbedTrayIcon(title)
self.xembed_tray_icon.start()
wait: WebDriverWait = WebDriverWait(self.driver, 10)
try:
# FocusScope in StatusNotifierItem.qml
wait.until(EC.presence_of_element_located((AppiumBy.NAME, title)))
except TimeoutException:
self.fail(f"Cannot find the XEmbed icon in the system tray: {self.xembedsniproxy.stderr.readlines()}")
# Create a reader thread to work around read block
self.stream_reader_thread = StreamReaderThread(self.xembedsniproxy.stderr)
self.stream_reader_thread.start()
self.assertTrue(self.stream_reader_thread.is_alive(), "The reader thread is not running")
# Now test clickable
self.driver.find_element(AppiumBy.NAME, title).click()
success: bool = False
for _ in range(10):
if self.stream_reader_thread.readline() is not None:
success = True
break
print("Retrying...", file=sys.stderr, flush=True)
self.driver.find_element(AppiumBy.NAME, title).click()
self.assertTrue(success, "xembedsniproxy did not receive the click event")
# The tray icon is a red square
try:
rect: dict[str, int] = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(170, 0, 0))["rect"]
except WebDriverException: # Rendering delay
time.sleep(1)
rect: dict[str, int] = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(170, 0, 0))["rect"]
if os.getenv("TEST_WITH_KWIN_WAYLAND", "1") == "0":
return
# Left click
self.click_center(rect)
# Middle click
self.click_center(rect, MouseButton.MIDDLE)
# Right click
self.click_center(rect, MouseButton.RIGHT)
self.assertTrue(self.xembed_tray_icon.popup_menu_event.is_set())
# Scroll up
self.scroll_center(rect, 0, -15)
# Scroll down
self.scroll_center(rect, 0, 15)
# Scroll left
self.scroll_center(rect, -15, 0)
# Scroll right
self.scroll_center(rect, 15, 0)
@unittest.skipIf(os.getenv("TEST_WITH_KWIN_WAYLAND", "1") == "0", "inputsynth only works on Wayland")
def test_2_statusnotifieritem(self) -> None:
"""
Tests for org.kde.StatusNotifierItem
1. Left click
2. Right click
3. Middle click
4. Wheel
5. Activate menu actions
6. NeedsAttention/Active/Passive status
"""
try:
from PySide6.QtCore import QObject
except ModuleNotFoundError:
self.skipTest("PySide is not available")
asan_env = os.environ.copy()
asan_env["LD_PRELOAD"] = subprocess.check_output(["gcc", "-print-file-name=libasan.so"]).strip().decode(encoding="utf-8")
status_notifier = subprocess.Popen([os.path.join(os.path.dirname(os.path.abspath(__file__)), "systemtraytest", "statusnotifieritemtest.py")], stdout=subprocess.PIPE, stderr=sys.stderr, env=asan_env)
self.addCleanup(status_notifier.kill)
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((AppiumBy.NAME, "StatusNotifierTest")))
time.sleep(0.5) # Extra buffer for D-Bus signal connections
rect: dict = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(255, 0, 0))["rect"] # Red
expected_result: list[str] = []
# Left click
self.click_center(rect)
expected_result.append("Activated")
# Middle click
self.click_center(rect, MouseButton.MIDDLE)
expected_result.append("SecondaryActivated")
# Scroll up
self.scroll_center(rect, 0, -15)
expected_result.append("Scrolled by 180 Vertically")
# Scroll down
self.scroll_center(rect, 0, 15)
expected_result.append("Scrolled by -180 Vertically")
time.sleep(1)
# Scroll left
self.scroll_center(rect, -15, 0)
expected_result.append("Scrolled by 180 Horizontally")
# Scroll right
self.scroll_center(rect, 15, 0)
expected_result.append("Scrolled by -180 Horizontally")
# Right click
self.click_center(rect, MouseButton.RIGHT)
# Click the first action to change the color to blue
rect = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(0, 255, 0))["rect"] # Green
self.click_center(rect)
expected_result.append("NeedsAttention")
# Right click
rect = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(0, 0, 255))["rect"] # Blue
self.click_center(rect, MouseButton.RIGHT)
# Click the second action to change the color to red
rect = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(255, 85, 255))["rect"] # Purple
self.click_center(rect)
expected_result.append("Active")
# Right click
rect = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(255, 0, 0))["rect"] # Red
self.click_center(rect, MouseButton.RIGHT)
# Move to the submenu item
rect = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(85, 0, 255))["rect"]
self.click_center(rect)
# Move to the submenu
rect = self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(255, 255, 0))["rect"] # Yellow
self.click_center(rect)
expected_result.append("Passive")
# The icon is hidden
self.assertRaises(Exception, self.driver.find_image_occurrence, self.take_screenshot(), generate_color_block(255, 0, 0))
status_notifier.kill()
status_notifier.wait(10)
output = status_notifier.stdout.readlines()
self.assertEqual(len(expected_result), len(output), f"output: f{output} expected: {expected_result}")
for l in range(0, len(expected_result)):
self.assertEqual(output[l].decode().strip(), expected_result[l])
@unittest.skipIf(os.getenv("TEST_WITH_KWIN_WAYLAND", "1") == "0", "Screenshot")
def test_2_1_sni_svg_icon(self) -> None:
"""
Shows the tray icon if the source is an svg file
"""
try:
from PySide6.QtCore import QObject
except ModuleNotFoundError:
self.skipTest("PySide is not available")
with subprocess.Popen(["python3", os.path.join(os.path.dirname(os.path.abspath(__file__)), "systemtraytest", "svgtrayicon.py")], stdout=sys.stderr, stderr=sys.stderr) as process:
sni_title = "SvgTrayIconTest"
logging.info(self.driver.page_source)
element = self.driver.find_element(AppiumBy.NAME, sni_title)
# The tray icon is a red square
self.driver.find_image_occurrence(self.take_screenshot(), generate_color_block(255, 0, 0))
process.kill()
WebDriverWait(self.driver, 10).until(EC.invisibility_of_element(element))
@unittest.skipIf(os.environ.get("TEST_WITH_KWIN_WAYLAND", "1") == "0", "In openbox, the popup is not focused by default, so sending keys will not work.")
def test_3_bug479466_keyboard_navigation_in_HiddenItemsView(self) -> None:
"""
Make sure iconContainer in AbstractItem.qml has the default focus so it can receive key presses
"""
self.driver.find_element(AppiumBy.NAME, "Show hidden icons").click()
wait = WebDriverWait(self.driver, 10)
wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Notifications")))
time.sleep(1)
# By default the focused item is "Notifications"
# Press Enter key directly to open the widget
if os.environ.get("TEST_WITH_KWIN_WAYLAND", "1") == "0":
subprocess.check_call(["xdotool", "key", "Return"])
else:
actions = ActionChains(self.driver)
actions.send_keys(Keys.ENTER).perform()
element = wait.until(EC.presence_of_element_located((AppiumBy.NAME, "Do not disturb")))
self.driver.find_element(AppiumBy.NAME, "Go Back").click()
wait.until(EC.invisibility_of_element(element))
if os.environ.get("TEST_WITH_KWIN_WAYLAND", "1") == "0":
subprocess.check_call(["xdotool", "key", "Escape"])
else:
ActionChains(self.driver).send_keys(Keys.ESCAPE).perform()
def test_4_dbus_activated_plasmoid(self) -> None:
"""
Dynamically load a Plasmoid into the systemtray when a specific service becomes available
"""
with subprocess.Popen(["python3", os.path.join(os.path.dirname(os.path.abspath(__file__)), "systemtraytest", "dbusservice.py")], stdout=subprocess.PIPE, stderr=sys.stderr, text=True) as process:
assert process.stdout is not None
ready_line = process.stdout.readline()
assert ready_line.strip() == "READY", f"Unexpected output: {ready_line}"
plasmoid_title = "Do not translate Test only"
element = WebDriverWait(self.driver, 10).until(
EC.presence_of_element_located((AppiumBy.NAME, plasmoid_title))
)
process.terminate()
process.wait()
WebDriverWait(self.driver, 10).until(EC.invisibility_of_element(element))
if __name__ == '__main__':
assert "USE_CUSTOM_BUS" in os.environ
assert "GDK_BACKEND" in os.environ or "TEST_WITH_KWIN_WAYLAND" in os.environ
logging.getLogger().setLevel(logging.INFO)
unittest.main()
@@ -0,0 +1,78 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
# pylint: disable=too-many-arguments
import logging
import signal
from typing import Final
from gi.repository import Gio, GLib
class OrgKdeTestdbusactivation:
"""
DBus interface for org.kde.testdbusactivation
"""
BUS_NAME: Final = "org.kde.testdbusactivation"
OBJECT_PATH: Final = "/test"
connection: Gio.DBusConnection | None = None
def __init__(self) -> None:
self.reg_id: int = 0
self.owner_id: int = Gio.bus_own_name(Gio.BusType.SESSION, self.BUS_NAME, Gio.BusNameOwnerFlags.NONE, self.on_bus_acquired, None, None)
assert self.owner_id > 0
def quit(self) -> None:
if self.connection is None:
return
self.connection.unregister_object(self.reg_id)
Gio.bus_unown_name(self.owner_id)
self.connection.flush_sync(None)
def on_bus_acquired(self, connection: Gio.DBusConnection, name: str, *args) -> None:
"""
Interface is ready, now register objects.
"""
self.connection = connection
introspection_data = Gio.DBusNodeInfo.new_for_xml("""
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.testdbusactivation">
<method name="ping" />
</interface>
</node>
""")
self.reg_id = connection.register_object(self.OBJECT_PATH, introspection_data.interfaces[0], self.handle_method_call, None, None)
assert self.reg_id > 0
print("READY", flush=True)
logging.info("Interface is ready")
def handle_method_call(self, connection: Gio.DBusConnection, sender: str, object_path: str, interface_name: str, method_name: str, parameters: GLib.Variant, invocation: Gio.DBusMethodInvocation) -> None:
invocation.return_value(None)
dbus_interface: OrgKdeTestdbusactivation | None = None
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
dbus_interface = OrgKdeTestdbusactivation()
loop = GLib.MainLoop()
def on_signal(sig: int, frame) -> None:
logging.info(f"Received signal {sig}, quitting...")
if dbus_interface:
dbus_interface.quit()
loop.quit()
signal.signal(signal.SIGTERM, on_signal)
signal.signal(signal.SIGINT, on_signal)
loop.run()
@@ -0,0 +1,16 @@
/*
SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
SPDX-License-Identifier: MIT
*/
import QtQuick
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.plasmoid
PlasmoidItem {
id: bluetoothApplet
compactRepresentation: Rectangle { color: "red" }
fullRepresentation: Rectangle { color: "green" }
Plasmoid.status: PlasmaCore.Types.ActiveStatus
}
@@ -0,0 +1,36 @@
{
"KPackageStructure": "Plasma/Applet",
"KPlugin": {
"Category": "System Information",
"EnabledByDefault": true,
"Icon": "preferences-system-bluetooth",
"Id": "org.kde.testdbusactivation",
"Name": "Do not translate Test only",
"Name[be]": "Do not translate Test only",
"Name[bg]": "Само тест без превод",
"Name[ca@valencia]": "Do not translate Test only",
"Name[ca]": "Do not translate Test only",
"Name[en_GB]": "Do not translate Test only",
"Name[es]": "No traducir. Solo prueba",
"Name[eu]": "Do not translate Test only",
"Name[fr]": "Ne pas traduire. Pour test uniquement",
"Name[he]": "Do not translate Test only",
"Name[id]": "Jangan terjemahkan hanya Pengujian",
"Name[it]": "Do not translate Test only",
"Name[ka]": "Do not translate Test only",
"Name[lt]": "Do not translate Test only",
"Name[lv]": "Do not translate Test only",
"Name[nl]": "Niet alleen Test vertalen",
"Name[pl]": "Do not translate Test only",
"Name[sa]": "केवलं Test इत्यस्य अनुवादं न कुर्वन्तु",
"Name[sl]": "Ne prevajaj Samo za test",
"Name[sv]": "Do not translate Test only",
"Name[tr]": "Do not translate Test only",
"Name[uk]": "Do not translate Test only",
"Name[x-test]": "xxDo not translate Test onlyxx",
"Name[zh_CN]": "Do not translate Test only"
},
"X-Plasma-API-Minimum-Version": "6.0",
"X-Plasma-DBusActivationService": "org.kde.testdbusactivation",
"X-Plasma-NotificationAreaCategory": "Hardware"
}
@@ -0,0 +1,2 @@
SPDX-License-Identifier: CC0-1.0
SPDX-FileCopyrightText: none
@@ -0,0 +1,85 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2025 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import sys
import KStatusNotifierItem
from PySide6.QtCore import QObject, QPoint, Qt
from PySide6.QtGui import QColor, QIcon, QPixmap
from PySide6.QtWidgets import QApplication, QMenu
class StatusNotifierTest(QObject):
def __init__(self, parent=None) -> None:
super().__init__(parent)
self.system_notifier = KStatusNotifierItem.KStatusNotifierItem("org.kde.statusnotifiertest", self)
self.system_notifier.setCategory(KStatusNotifierItem.KStatusNotifierItem.ItemCategory.Communications)
icon = self.create_icon(Qt.red)
self.system_notifier.setIconByPixmap(icon)
self.system_notifier.setStatus(KStatusNotifierItem.KStatusNotifierItem.ItemStatus.Active)
self.system_notifier.setToolTipTitle("StatusNotifierTest")
self.system_notifier.setTitle("StatusNotifierTest")
self.system_notifier.setToolTipSubTitle("Some explanation from the beach.")
menu = QMenu()
icon = self.create_icon(QColor(0, 255, 0)) # green
action = menu.addAction(icon, "NeedsAttention")
action.triggered.connect(self.action_triggered)
icon = self.create_icon(QColor(255, 85, 255)) # purple
action = menu.addAction(icon, "Active")
action.triggered.connect(self.action_triggered)
sub_menu = QMenu("Sub Menu")
sub_menu.setIcon(self.create_icon(QColor(85, 0, 255)))
icon = self.create_icon(QColor(255, 255, 0)) # yellow
sub_action = sub_menu.addAction(icon, "Passive")
sub_action.triggered.connect(self.action_triggered)
menu.addMenu(sub_menu)
self.system_notifier.setContextMenu(menu)
self.system_notifier.activateRequested.connect(self.activate_requested)
self.system_notifier.secondaryActivateRequested.connect(self.secondary_activate_requested)
self.system_notifier.scrollRequested.connect(self.scroll_requested)
@staticmethod
def create_icon(color) -> QIcon:
pixmap = QPixmap(16, 16)
pixmap.fill(color)
return QIcon(pixmap)
def action_triggered(self) -> None:
text = self.sender().text()
print(text, flush=True)
if text == "NeedsAttention":
self.system_notifier.setStatus(KStatusNotifierItem.KStatusNotifierItem.ItemStatus.NeedsAttention)
self.system_notifier.setIconByPixmap(self.create_icon(Qt.blue))
elif text == "Active":
self.system_notifier.setStatus(KStatusNotifierItem.KStatusNotifierItem.ItemStatus.Active)
self.system_notifier.setIconByPixmap(self.create_icon(Qt.red))
elif text == "Passive":
self.system_notifier.setStatus(KStatusNotifierItem.KStatusNotifierItem.ItemStatus.Passive)
else:
raise RuntimeError("Unexpected action triggered")
def activate_requested(self, active: bool, pos: QPoint) -> None:
print("Activated", flush=True)
def secondary_activate_requested(self, pos: QPoint) -> None:
print("SecondaryActivated", flush=True)
def scroll_requested(self, delta: int, orientation: Qt.Orientation) -> None:
direction = "Horizontally" if orientation == Qt.Horizontal else "Vertically"
print(f"Scrolled by {delta} {direction}", flush=True)
if __name__ == "__main__":
app = QApplication(sys.argv)
test = StatusNotifierTest()
sys.exit(app.exec())
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2025 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import os
import sys
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QApplication, QSystemTrayIcon
class TestApplication(QApplication):
def __init__(self, argv) -> None:
super().__init__(argv)
self.setApplicationName("SvgTrayIconTest")
self.tray_icon = QSystemTrayIcon(QIcon(os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__))), "svgtrayicon.svg")), self)
self.tray_icon.activated.connect(self.on_tray_icon_activated)
self.tray_icon.show()
def on_tray_icon_activated(self, reason) -> None:
if reason is QSystemTrayIcon.Trigger:
self.quit()
if __name__ == "__main__":
app = TestApplication(sys.argv)
sys.exit(app.exec())
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
SPDX-FileCopyrightText: None
SPDX-License-Identifier: CC0-1.0
Created with Inkscape (http://www.inkscape.org/)
-->
<svg
width="19.090908mm"
height="19.090908mm"
viewBox="0 0 19.090908 19.090908"
version="1.1"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<g
id="layer1">
<rect
style="fill:#ff0000;stroke-width:0.265692"
id="rect1"
width="16"
height="16"
x="0"
y="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 584 B

@@ -0,0 +1,79 @@
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: BSD-3-Clause
# KCM autotests
add_test(
NAME kcm_autostart_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_autostart_test.py
)
add_test(
NAME kcm_colors_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_colors_test.py
)
add_test(
NAME kcm_cursortheme_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_cursortheme_test.py
)
add_test(
NAME kcm_desktoptheme_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_desktoptheme_test.py
)
add_test(
NAME kcm_feedback_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_feedback_test.py
)
add_test(
NAME kcm_fonts_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_fonts_test.py
)
add_test(
NAME kcm_icons_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_icons_test.py
)
add_test(
NAME kcm_fontinst_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_fontinst_test.py
)
add_test(
NAME kcm_lookandfeel_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_lookandfeel_test.py
)
add_test(
NAME kcm_nightlight_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_nightlight_test.py
)
add_test(
NAME kcm_notifications_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_notifications_test.py
)
add_test(
NAME kcm_regionandlang_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_regionandlang_test.py
)
add_test(
NAME kcm_soundtheme_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_soundtheme_test.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_test(
NAME kcm_style_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_style_test.py
)
add_test(
NAME kcm_users_test
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/kcm_users_test.py --failfast
)
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_autostart"
class KCMAutoStartTest(KCMTest):
"""
Tests for kcm_autostart
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Add new application or script")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_colors"
class KCMColorsTest(KCMTest):
"""
Tests for kcm_colors
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "All schemes")
self.driver.find_element(AppiumBy.NAME, "Breeze Dark")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,91 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import base64
import os
import shutil
import tempfile
import unittest
from typing import Final
import gi
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
gi.require_version('Gdk', '4.0')
gi.require_version('GdkPixbuf', '2.0')
from gi.repository import Gdk, GdkPixbuf, GLib
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_cursortheme"
class KCMCursorThemeTest(KCMTest):
"""
Tests for kcm_cursortheme
"""
kcm_id = KCM_ID
extra_environ = {
"QT_LOGGING_RULES": "kcm_cursortheme.debug=true",
}
@classmethod
def setUpClass(cls) -> None:
user_data_dir: Final[str] = GLib.get_user_data_dir()
icons_folder: Final = os.path.join(user_data_dir, "icons")
if not os.path.exists(icons_folder):
os.mkdir(icons_folder)
cls.addClassCleanup(lambda: shutil.rmtree(icons_folder))
icon_theme_folder: Final = os.path.join(user_data_dir, "icons", "testcursortheme")
assert not os.path.exists(icon_theme_folder)
test_data_folder: Final = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir, os.pardir, "kcms", "cursortheme", "autotests", "data", "testcursortheme")
assert os.path.exists(test_data_folder)
shutil.copytree(test_data_folder, icon_theme_folder)
cls.addClassCleanup(lambda: shutil.rmtree(icon_theme_folder))
cls.extra_environ = {
"QT_LOGGING_RULES": "kcm_cursortheme.debug=true",
"XCURSOR_PATH": icons_folder,
}
super().setUpClass()
def test_0_open(self) -> None:
"""
Tests the KCM and the launcher feedback dialog can be opened
"""
self.driver.find_element(AppiumBy.NAME, "&Configure Launch Feedback…")
self.driver.find_element(AppiumBy.NAME, "Test Cursor Theme (DO NOT TRANSLATE)")
self.driver.find_element(AppiumBy.NAME, "&Configure Launch Feedback…").click()
self.driver.find_element(AppiumBy.NAME, "Blinking")
close_button = self.driver.find_element(AppiumBy.XPATH, "//button[@name='Close' and contains(@accessibility-id, 'LaunchFeedbackDialog')]")
close_button.click()
WebDriverWait(self.driver, 10).until(EC.invisibility_of_element(close_button))
def test_1_cursor_theme_preview(self) -> None:
"""
Tests if the cursor preview is loaded
"""
with tempfile.TemporaryDirectory() as temp_dir:
saved_image_path: str = os.path.join(temp_dir, "kcm_window.png")
self.driver.get_screenshot_as_file(saved_image_path)
full_image = base64.b64encode(Gdk.Texture.new_from_filename(saved_image_path).save_to_png_bytes().get_data()).decode()
# Red
partial_pixbuf = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 16, 16)
partial_pixbuf.fill(0xff0000ff)
partial_image = base64.b64encode(Gdk.Texture.new_for_pixbuf(partial_pixbuf).save_to_png_bytes().get_data()).decode()
self.driver.find_image_occurrence(full_image, partial_image)
if __name__ == '__main__':
unittest.main(failfast=True)
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_desktoptheme"
class KCMDesktopThemeTest(KCMTest):
"""
Tests for kcm_desktoptheme
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "All themes")
self.driver.find_element(AppiumBy.NAME, "Breeze Light")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_feedback"
class KCMFeedbackTest(KCMTest):
"""
Tests for kcm_feedback
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Plasma:")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_fontinst"
class KCMFontInstTest(KCMTest):
"""
Tests for kcm_fontinst
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Find Duplicates…")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_fonts"
class KCMFontsTest(KCMTest):
"""
Tests for kcm_fonts
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
# Since Qt 6.10 ampersand is stripped, so use contains instead of equals
self.driver.find_element(AppiumBy.XPATH, "//button[contains(@name, 'Adjust All Fonts…')]")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_icons"
class KCMIconsTest(KCMTest):
"""
Tests for kcm_icons
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Breeze Dark")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_lookandfeel"
class KCMLookAndFeelTest(KCMTest):
"""
Tests for kcm_lookandfeel
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Breeze Dark")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_nightlight"
class KCMNightLightTest(KCMTest):
"""
Tests for kcm_nightlight
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "The blue light filter makes the colors on the screen warmer.")
self.driver.find_element(AppiumBy.NAME, "Day light temperature:")
self.driver.find_element(AppiumBy.NAME, "Night light temperature:")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_notifications"
class KCMNotificationsTest(KCMTest):
"""
Tests for kcm_notifications
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Critical notifications:")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_regionandlang"
class KCMRegionAndLangTest(KCMTest):
"""
Tests for kcm_regionandlang
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Language")
self.driver.find_element(AppiumBy.NAME, "Time")
self.driver.find_element(AppiumBy.NAME, "Modify…")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,61 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import os
import shutil
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
from gi.repository import GLib
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_soundtheme"
class KCMSoundThemeTest(KCMTest):
"""
Tests for kcm_soundtheme
"""
kcm_id = KCM_ID
@classmethod
def setUpClass(cls) -> None:
system_data_dirs: Final[list[str]] = GLib.get_system_data_dirs()
freedesktop_sound_theme_installed: bool = False
for system_data_dir in system_data_dirs:
if os.path.exists(os.path.join(system_data_dir, "sounds", "freedesktop", "index.theme")):
freedesktop_sound_theme_installed = True
break
if not freedesktop_sound_theme_installed:
user_data_dir: Final[str] = GLib.get_user_data_dir()
sounds_folder: Final = os.path.join(user_data_dir, "sounds")
if not os.path.exists(sounds_folder):
os.mkdir(sounds_folder)
cls.addClassCleanup(lambda: shutil.rmtree(sounds_folder))
fdo_sound_theme_folder: Final = os.path.join(user_data_dir, "sounds", "freedesktop")
if not os.path.exists(fdo_sound_theme_folder):
shutil.copytree("../../kcms/soundtheme/autotests/data/freedesktop", fdo_sound_theme_folder)
cls.addClassCleanup(lambda: shutil.rmtree(fdo_sound_theme_folder))
super().setUpClass()
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "FreeDesktop")
self.driver.find_element(AppiumBy.NAME, "Fallback sound theme from freedesktop.org")
self.driver.find_element(AppiumBy.NAME, "Preview:")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_style"
class KCMStyleTest(KCMTest):
"""
Tests for kcm_style
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Fusion")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,49 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import unittest
from typing import Final
from appium.webdriver.common.appiumby import AppiumBy
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utils.base_test import KCMTest
KCM_ID: Final = "kcm_users"
class KCMUsersTest(KCMTest):
"""
Tests for kcm_users
"""
kcm_id = KCM_ID
def test_0_open(self) -> None:
"""
Tests the KCM can be opened
"""
self.driver.find_element(AppiumBy.NAME, "Add New User…")
self.driver.find_element(AppiumBy.NAME, "Name:")
self.driver.find_element(AppiumBy.NAME, "Change Password")
self.driver.find_element(AppiumBy.NAME, "Delete User…")
def test_1_pictures_sheet_1_open(self) -> None:
"""
Opens the avatar sheet
"""
self.driver.find_element(AppiumBy.NAME, "Change avatar").click()
self.driver.find_element(AppiumBy.NAME, "Choose File…")
# Doesn't work without account service
# self.driver.find_element(AppiumBy.NAME, "Initials")
# self.driver.find_element(AppiumBy.NAME, "Placeholder Icon")
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,9 @@
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: BSD-3-Clause
add_test(
NAME krunnertest
COMMAND selenium-webdriver-at-spi-run ${CMAKE_CURRENT_SOURCE_DIR}/krunnertest.py
)
set_tests_properties(krunnertest PROPERTIES
ENVIRONMENT "USE_CUSTOM_BUS=1")
@@ -0,0 +1,81 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
import subprocess
import time
import unittest
from typing import Final
from appium import webdriver
from appium.options.common.base import AppiumOptions
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
KDE_VERSION: Final = 6
class KRunnerTest(unittest.TestCase):
"""
Tests for the main ui
"""
driver: webdriver.Remote
@classmethod
def setUpClass(cls) -> None:
"""
Opens the KCM and initialize the webdriver
"""
options = AppiumOptions()
options.set_capability("app", "krunner")
options.set_capability("environ", {
"LC_ALL": "en_US.UTF-8",
"QT_LOGGING_RULES": "qt.accessibility.atspi.warning=false",
})
options.set_capability("timeouts", {'implicit': 10000})
cls.driver = webdriver.Remote(command_executor='http://127.0.0.1:4723', options=options)
def tearDown(self) -> None:
"""
Take screenshot when the current test fails
"""
if not self._outcome.result.wasSuccessful():
self.driver.get_screenshot_as_file(f"failed_test_shot_krunnertest_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
"""
Make sure to terminate the driver again, lest it dangles.
"""
subprocess.check_call([f"kquitapp{KDE_VERSION}", "krunner"])
for _ in range(10):
try:
subprocess.check_call(["pidof", "krunner"])
except subprocess.CalledProcessError:
break
time.sleep(1)
cls.driver.quit()
def test_0_open(self) -> None:
"""
Tests the main ui can be opened
"""
button_element = self.driver.find_element(AppiumBy.NAME, "Configure") # RunCommand.qml
searchfield_element = self.driver.find_element(AppiumBy.NAME, "Search")
wait = WebDriverWait(self.driver, 5)
searchfield_element.send_keys("99999+99999")
wait.until(EC.presence_of_element_located((AppiumBy.NAME, "199998")))
actions = ActionChains(self.driver)
actions.send_keys(Keys.ESCAPE).perform()
wait.until(EC.invisibility_of_element(button_element))
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: GPL-2.0-or-later
# For FreeBSD CI which only has python 3.9
from __future__ import annotations
import threading
import time
from gi.repository import GLib
class GLibMainLoopThread(threading.Thread):
"""
A GLib main loop in another thread.
@note It's redundant to create a loop when QCoreApplication is used in the same application.
"""
loop: GLib.MainLoop | None = None
def __init__(self) -> None:
# Set up D-Bus loop
self.loop = GLib.MainLoop()
self.failSafeTimer = threading.Timer(60, self.loop.quit)
# Create the thread
super(GLibMainLoopThread, self).__init__()
def run(self) -> None:
"""
Method to run the DBus main loop (on a thread)
"""
self.failSafeTimer.start()
self.loop.run()
def quit(self) -> None:
self.failSafeTimer.cancel()
self.loop.quit()
@classmethod
def process_events(cls) -> None:
"""
Processes some pending events in the main loop
"""
if cls.loop is not None:
context = cls.loop.get_context()
else:
context = GLib.MainContext.default()
for _ in range(4):
if not context.pending():
time.sleep(0.1)
continue
context.iteration(may_block=False)
break
@@ -0,0 +1,31 @@
# SPDX-FileCopyrightText: 2026 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
from .constants import (
APPIUM_SERVER_URL,
KDE_VERSION,
DEFAULT_IMPLICIT_TIMEOUT,
DEFAULT_WAIT_TIMEOUT,
PROCESS_WAIT_ITERATIONS,
PROCESS_WAIT_INTERVAL,
)
from .base_test import PlasmaAppletTest, KCMTest
from .process_helpers import quit_plasmawindowed, wait_for_process_exit, cleanup_plasmawindowed
from .notification_helpers import send_notification
from .GLibMainLoopThread import GLibMainLoopThread
__all__ = [
"APPIUM_SERVER_URL",
"KDE_VERSION",
"DEFAULT_IMPLICIT_TIMEOUT",
"DEFAULT_WAIT_TIMEOUT",
"PROCESS_WAIT_ITERATIONS",
"PROCESS_WAIT_INTERVAL",
"PlasmaAppletTest",
"KCMTest",
"quit_plasmawindowed",
"wait_for_process_exit",
"cleanup_plasmawindowed",
"send_notification",
"GLibMainLoopThread",
]
@@ -0,0 +1,92 @@
# SPDX-FileCopyrightText: 2026 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
"""Base test class for Appium tests."""
from __future__ import annotations
import os
import subprocess
import time
import unittest
from typing import ClassVar
from appium import webdriver
from appium.options.common.base import AppiumOptions
from .constants import APPIUM_SERVER_URL, DEFAULT_IMPLICIT_TIMEOUT, KDE_VERSION, PROCESS_WAIT_INTERVAL, PROCESS_WAIT_ITERATIONS
def _filter_fatal_warnings(environ: dict[str, str]) -> dict[str, str]:
"""Only enable QT_FATAL_WARNINGS when KDECI_BUILD is set."""
if "QT_FATAL_WARNINGS" in environ and "KDECI_BUILD" not in os.environ:
environ = dict(environ)
del environ["QT_FATAL_WARNINGS"]
return environ
class PlasmaAppletTest(unittest.TestCase):
"""Base test class for Plasma applet tests using plasmawindowed."""
driver: ClassVar[webdriver.Remote]
widget_id: ClassVar[str]
extra_environ: ClassVar[dict[str, str]] = {}
@classmethod
def setUpClass(cls) -> None:
options = AppiumOptions()
options.set_capability("app", f"plasmawindowed -p org.kde.plasma.nano {cls.widget_id}")
options.set_capability("timeouts", {'implicit': DEFAULT_IMPLICIT_TIMEOUT})
environ: dict[str, str] = {"LC_ALL": "en_US.UTF-8"}
environ.update(_filter_fatal_warnings(cls.extra_environ))
options.set_capability("environ", environ)
cls.driver = webdriver.Remote(command_executor=APPIUM_SERVER_URL, options=options)
def tearDown(self) -> None:
if not self._outcome.result.wasSuccessful():
self.driver.get_screenshot_as_file(f"failed_test_shot_{self.widget_id}_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
subprocess.check_call([f"kquitapp{KDE_VERSION}", "plasmawindowed"])
for _ in range(PROCESS_WAIT_ITERATIONS):
try:
subprocess.check_call(["pidof", "plasmawindowed"])
except subprocess.CalledProcessError:
break
time.sleep(PROCESS_WAIT_INTERVAL)
cls.driver.quit()
class KCMTest(unittest.TestCase):
"""Base test class for KCM tests using kcmshell."""
driver: ClassVar[webdriver.Remote]
kcm_id: ClassVar[str]
extra_environ: ClassVar[dict[str, str]] = {}
@classmethod
def setUpClass(cls) -> None:
options = AppiumOptions()
options.set_capability("app", f"kcmshell{KDE_VERSION} {cls.kcm_id}")
options.set_capability("timeouts", {'implicit': DEFAULT_IMPLICIT_TIMEOUT})
environ: dict[str, str] = {"LC_ALL": "en_US.UTF-8"}
environ.update(_filter_fatal_warnings(cls.extra_environ))
options.set_capability("environ", environ)
cls.driver = webdriver.Remote(command_executor=APPIUM_SERVER_URL, options=options)
def tearDown(self) -> None:
if not self._outcome.result.wasSuccessful():
self.driver.get_screenshot_as_file(f"failed_test_shot_{self.kcm_id}_#{self.id()}.png")
@classmethod
def tearDownClass(cls) -> None:
from appium.webdriver.common.appiumby import AppiumBy
cls.driver.find_element(AppiumBy.XPATH, "//*[@name='Close' and contains(@accessibility-id, 'Button')]").click()
for _ in range(PROCESS_WAIT_ITERATIONS):
try:
subprocess.check_call(["pidof", f"kcmshell{KDE_VERSION}"])
except subprocess.CalledProcessError:
break
time.sleep(PROCESS_WAIT_INTERVAL)
cls.driver.quit()
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
"""Common constants for Appium tests."""
APPIUM_SERVER_URL: str = "http://127.0.0.1:4723"
KDE_VERSION: int = 6
DEFAULT_IMPLICIT_TIMEOUT: int = 10000
DEFAULT_WAIT_TIMEOUT: int = 10
PROCESS_WAIT_ITERATIONS: int = 10
PROCESS_WAIT_INTERVAL: float = 1.0
@@ -0,0 +1,46 @@
# SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
"""Notification utilities for tests."""
from typing import Any
import gi
gi.require_version('Gdk', '4.0')
from gi.repository import Gio, GLib
BUS_NAME: str = "org.freedesktop.Notifications"
OBJECT_PATH: str = "/org/freedesktop/Notifications"
IFACE_NAME: str = BUS_NAME
def send_notification(
data: dict[str, str | int | list[str] | dict[str, GLib.Variant] | GLib.Variant],
session_bus: Gio.DBusConnection | None = None
) -> int:
"""
Send a notification via D-Bus.
Args:
data: Notification data dictionary with keys like app_name, summary, body, etc.
session_bus: Optional D-Bus connection. If None, uses default session bus.
Returns:
Notification id
"""
app_name: str = str(data.get("app_name", "Appium Test"))
replaces_id: int = int(data.get("replaces_id", 0))
app_icon: str = str(data.get("app_icon", "wayland"))
summary: str = str(data.get("summary", ""))
body: str = str(data.get("body", ""))
actions: list[str] = data.get("actions", []) # type: ignore
hints: dict[str, GLib.Variant] = data.get("hints", {}) # type: ignore
timeout: int = data.get("timeout", -1) # type: ignore
parameters = GLib.Variant("(susssasa{sv}i)", [app_name, replaces_id, app_icon, summary, body, actions, hints, timeout])
if session_bus is None:
session_bus = Gio.bus_get_sync(Gio.BusType.SESSION)
reply = session_bus.call_sync(BUS_NAME, OBJECT_PATH, IFACE_NAME, "Notify", parameters, None, Gio.DBusSendMessageFlags.NONE, 5000)
return reply.get_child_value(0).get_uint32()
@@ -0,0 +1,29 @@
# SPDX-FileCopyrightText: 2026 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: MIT
"""Process management utilities for tests."""
import subprocess
import time
from .constants import KDE_VERSION, PROCESS_WAIT_INTERVAL, PROCESS_WAIT_ITERATIONS
def quit_plasmawindowed() -> None:
"""Quit plasmawindowed process."""
subprocess.check_call([f"kquitapp{KDE_VERSION}", "plasmawindowed"])
def wait_for_process_exit(process_name: str) -> None:
"""Wait for a process to exit."""
for _ in range(PROCESS_WAIT_ITERATIONS):
try:
subprocess.check_call(["pidof", process_name])
except subprocess.CalledProcessError:
break
time.sleep(PROCESS_WAIT_INTERVAL)
def cleanup_plasmawindowed() -> None:
"""Clean up plasmawindowed process."""
quit_plasmawindowed()
wait_for_process_exit("plasmawindowed")
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
# SPDX-License-Identifier: BSD-3-Clause
add_test(
NAME wallpaperinstalltest
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/installtest.py --failfast
)
set_tests_properties(wallpaperinstalltest PROPERTIES ENVIRONMENT "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}/bin")

Some files were not shown because too many files have changed in this diff Show More