diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/compare | 3 | ||||
-rw-r--r-- | tests/test-painter.cpp | 90 |
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(); } |