summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-29 14:03:10 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-10-29 14:03:10 -0500
commit0bf8ed2645fa9721cdf2ebab5e81307e1649b967 (patch)
treed9c0d0e0c1d6d7090a32771266eb709bfcfb508a /tests
parent623f11f6000cb2f05f51c81e7a1c6fc02ce21907 (diff)
downloadgtk3-tqt-engine-0bf8ed2645fa9721cdf2ebab5e81307e1649b967.tar.gz
gtk3-tqt-engine-0bf8ed2645fa9721cdf2ebab5e81307e1649b967.zip
A few widgets are now working somewhat
Diffstat (limited to 'tests')
-rwxr-xr-xtests/compare3
-rw-r--r--tests/test-painter.cpp90
2 files changed, 93 insertions, 0 deletions
diff --git a/tests/compare b/tests/compare
new file mode 100755
index 0000000..83726c5
--- /dev/null
+++ b/tests/compare
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+composite -compose subtract tqt3.png stroke.png diff.png
diff --git a/tests/test-painter.cpp b/tests/test-painter.cpp
index 3c21432..f912009 100644
--- a/tests/test-painter.cpp
+++ b/tests/test-painter.cpp
@@ -257,6 +257,96 @@ void runTests(TQPaintDevice* pd) {
cg.setColor(TQColorGroup::Foreground, TQColor(0,0,0));
tqApp->style().drawPrimitive(TQStyle::PE_ExclusiveIndicator, &p, TQRect(400, 400, 16, 16), cg, TQStyle::Style_Down);
+ // Tab bar tab tests
+ {
+ int currentPage;
+ int numPages=3;
+ int tabIndex=2;
+
+ int x = 0;
+ int y = 300;
+ int width = 50;
+ int height = 20;
+
+ for (currentPage=0;currentPage<numPages;currentPage++) {
+ TQRect boundingRect(0, 0, width, height);
+
+ TQStringList objectTypes;
+ objectTypes.append(TQTABBAR_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+
+ TQTab tqt3Tab;
+ tqt3Tab.setIdentifier(currentPage);
+ TQStyleOption tabOpt(&tqt3Tab, (TQTab*)NULL);
+
+ elementFlags = elementFlags | TQStyle::CEF_HasParentWidget;
+ ceData.parentWidgetData.widgetObjectTypes.append(TQTABBAR_OBJECT_NAME_STRING);
+
+ int tab_overlap = tqApp->style().pixelMetric(TQStyle::PM_TabBarTabOverlap);
+ x = x + width + tab_overlap;
+
+ boundingRect = TQRect(x, y, width+(tab_overlap*2), height);
+
+ ceData.tabBarData.shape = TQTabBar::RoundedAbove;
+ ceData.tabBarData.tabCount = numPages;
+ ceData.tabBarData.identIndexMap[tqt3Tab.identifier()] = currentPage;
+
+ TQColorGroup cg = tqApp->palette().active();
+
+ // Draw tab
+ tqApp->style().drawControl(TQStyle::CE_TabBarTab, &p, ceData, elementFlags, boundingRect, cg, ((tabIndex==currentPage)?TQStyle::Style_Selected:TQStyle::Style_Default), tabOpt);
+ }
+ }
+ {
+ int currentPage;
+ int numPages=3;
+ int tabIndex=2;
+
+ int x = (50*4);
+ int y = 325;
+ int width = 50;
+ int height = 20;
+
+ for (currentPage=(numPages-1);currentPage>=0;currentPage--) {
+ TQRect boundingRect(0, 0, width, height);
+
+ TQStringList objectTypes;
+ objectTypes.append(TQTABBAR_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ TQStyleControlElementData ceData;
+ TQStyle::ControlElementFlags elementFlags;
+ ceData.widgetObjectTypes = objectTypes;
+ ceData.rect = boundingRect;
+
+ TQTab tqt3Tab;
+ tqt3Tab.setIdentifier(currentPage);
+ TQStyleOption tabOpt(&tqt3Tab, (TQTab*)NULL);
+
+ elementFlags = elementFlags | TQStyle::CEF_HasParentWidget;
+ ceData.parentWidgetData.widgetObjectTypes.append(TQTABBAR_OBJECT_NAME_STRING);
+
+ int tab_overlap = tqApp->style().pixelMetric(TQStyle::PM_TabBarTabOverlap);
+ x = x - width - tab_overlap;
+
+ boundingRect = TQRect(x, y, width+(tab_overlap*2), height);
+
+ ceData.tabBarData.shape = TQTabBar::RoundedAbove;
+ ceData.tabBarData.tabCount = numPages;
+ ceData.tabBarData.identIndexMap[tqt3Tab.identifier()] = currentPage;
+
+ TQColorGroup cg = tqApp->palette().active();
+
+ // Draw tab
+ tqApp->style().drawControl(TQStyle::CE_TabBarTab, &p, ceData, elementFlags, boundingRect, cg, ((tabIndex==currentPage)?TQStyle::Style_Selected:TQStyle::Style_Default), tabOpt);
+ }
+ }
+
p.end();
}