File indexing completed on 2025-01-26 05:09:26
0001 /* 0002 * This file is part of the KDE wacomtablet project. For copyright 0003 * information and license terms see the AUTHORS and COPYING files 0004 * in the top-level directory of this distribution. 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License as 0008 * published by the Free Software Foundation; either version 2 of 0009 * the License, or (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #include "tabletdependenttest.h" 0021 #include "kded/x11tabletfinder.h" 0022 0023 using namespace Wacom; 0024 0025 TabletDependentTest::TabletDependentTest(QObject *parent) 0026 : QObject(parent) 0027 { 0028 m_isTabletAvailable = false; 0029 } 0030 0031 const TabletInformation &TabletDependentTest::getTabletInformation() const 0032 { 0033 return m_tabletInformation; 0034 } 0035 0036 bool TabletDependentTest::isTabletAvailable() const 0037 { 0038 return m_isTabletAvailable; 0039 } 0040 0041 void TabletDependentTest::findTablet() 0042 { 0043 X11TabletFinder tabletFinder; 0044 m_isTabletAvailable = false; 0045 0046 if (tabletFinder.scanDevices()) { 0047 m_tabletInformation = tabletFinder.getTablets().at(0); 0048 m_isTabletAvailable = true; 0049 0050 printTabletInformation(m_tabletInformation); 0051 } 0052 } 0053 0054 void TabletDependentTest::printTabletInformation(const TabletInformation &info) const 0055 { 0056 qDebug() << QString::fromLatin1( 0057 "\n\n Tablet Information:" 0058 "\n + Stylus Name : %1" 0059 "\n + Eraser Name : %2" 0060 "\n + Touch Name : %3" 0061 "\n + Pad Name : %4" 0062 "\n + Cursor Name : %5" 0063 "\n + Company ID : %6" 0064 "\n + Company Name : %7" 0065 "\n + Tablet ID : %8" 0066 "\n + Tablet Serial : %9" 0067 "\n + Tablet Name : %10" 0068 "\n + Tablet Model : %11" 0069 "\n") 0070 .arg(info.getDeviceName(DeviceType::Stylus)) 0071 .arg(info.getDeviceName(DeviceType::Eraser)) 0072 .arg(info.getDeviceName(DeviceType::Touch)) 0073 .arg(info.getDeviceName(DeviceType::Pad)) 0074 .arg(info.getDeviceName(DeviceType::Cursor)) 0075 .arg(info.get(TabletInfo::CompanyId)) 0076 .arg(info.get(TabletInfo::CompanyName)) 0077 .arg(info.get(TabletInfo::TabletId)) 0078 .arg(info.get(TabletInfo::TabletSerial)) 0079 .arg(info.get(TabletInfo::TabletName)) 0080 .arg(info.get(TabletInfo::TabletModel)); 0081 0082 foreach (const DeviceType &deviceType, DeviceType::list()) { 0083 const DeviceInformation *deviceInfo = info.getDevice(deviceType); 0084 0085 if (deviceInfo == nullptr) { 0086 continue; 0087 } 0088 0089 qDebug() << QString::fromLatin1( 0090 "\n\n Device '%1'" 0091 "\n + Device Id : %2" 0092 "\n + Product Id : %3" 0093 "\n + Vendor Id : %4" 0094 "\n + Device Node : %5" 0095 "\n") 0096 .arg(deviceInfo->getName()) 0097 .arg(deviceInfo->getDeviceId()) 0098 .arg(deviceInfo->getProductId()) 0099 .arg(deviceInfo->getVendorId()) 0100 .arg(deviceInfo->getDeviceNode()); 0101 } 0102 } 0103 0104 void TabletDependentTest::initTestCase() 0105 { 0106 findTablet(); 0107 0108 if (!isTabletAvailable()) { 0109 QSKIP("No tablet found! Can not run this tablet dependent test case!", SkipAll); 0110 return; 0111 } 0112 0113 // printTabletInformation(getTabletInformation()); 0114 0115 initTestCaseDependent(); 0116 } 0117 0118 #include "moc_tabletdependenttest.cpp"