Commit a9598e83 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Enable all of clazy level1

parent c10faf09
Pipeline #15370 passed with stage
in 13 minutes and 40 seconds
......@@ -48,7 +48,7 @@ build_clazy_clang_tidy:
script:
- srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json
- CLAZY_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot,connect-3arg-lambda,qproperty-without-notify" ninja
- CLAZY_CHECKS="level0,level1" ninja
# Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later
- sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h
- "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\""
......@@ -17,10 +17,6 @@
#include "core/document.h"
#include "testingutils.h"
static const QColor RED = QColor(255, 0, 0);
static const QColor GREEN = QColor(0, 255, 0.0);
// static const QColor BLUE = QColor(0, 0, 255);
class ModifyAnnotationPropertiesTest : public QObject
{
Q_OBJECT
......@@ -65,7 +61,7 @@ void ModifyAnnotationPropertiesTest::init()
m_annot1->setBoundingRectangle( Okular::NormalizedRect( 0.1, 0.1, 0.15, 0.15 ) );
m_annot1->setContents( QStringLiteral( "Hello, World" ) );
m_annot1->setAuthor( QStringLiteral("Jon Mease") );
m_annot1->style().setColor( RED );
m_annot1->style().setColor( Qt::red );
m_annot1->style().setWidth( 4.0 );
m_document->addPageAnnotation( 0, m_annot1 );
}
......@@ -86,22 +82,22 @@ void ModifyAnnotationPropertiesTest::testModifyAnnotationProperties()
// Now modify m_annot1's properties and record properties XML string
m_annot1->style().setWidth( 8.0 );
m_annot1->style().setColor( GREEN );
m_annot1->style().setColor( Qt::green );
m_document->modifyPageAnnotationProperties( 0, m_annot1 );
QString m_annot1XmlA = TestingUtils::getAnnotationXml( m_annot1 );
QCOMPARE( 8.0, m_annot1->style().width() );
QCOMPARE( GREEN, m_annot1->style().color() );
QCOMPARE( QColor(Qt::green), m_annot1->style().color() );
// undo modification and check that original properties have been restored
m_document->undo();
QCOMPARE( 4.0, m_annot1->style().width() );
QCOMPARE( RED, m_annot1->style().color() );
QCOMPARE( QColor(Qt::red), m_annot1->style().color() );
QCOMPARE( origLine1Xml, TestingUtils::getAnnotationXml( m_annot1 ) );
// redo modification and verify that new properties have been restored
m_document->redo();
QCOMPARE( 8.0, m_annot1->style().width() );
QCOMPARE( GREEN, m_annot1->style().color() );
QCOMPARE( QColor(Qt::green), m_annot1->style().color() );
QCOMPARE( m_annot1XmlA, TestingUtils::getAnnotationXml( m_annot1 ) );
// Verify that default values are properly restored. (We haven't explicitly set opacity yet)
......@@ -118,7 +114,7 @@ void ModifyAnnotationPropertiesTest::testModifyAnnotationProperties()
// And finally undo back to original properties
m_document->undo();
QCOMPARE( 4.0, m_annot1->style().width() );
QCOMPARE( RED, m_annot1->style().color() );
QCOMPARE( QColor(Qt::red), m_annot1->style().color() );
QCOMPARE( origLine1Xml, TestingUtils::getAnnotationXml( m_annot1 ) );
}
......
......@@ -35,7 +35,6 @@ class HandleDrag
{
setCursor( Qt::SizeAllCursor );
setFixedWidth( style()->pixelMetric( QStyle::PM_ToolBarHandleExtent ) );
installEventFilter( parent );
}
void paintEvent( QPaintEvent * ) override
......@@ -58,6 +57,7 @@ PresentationSearchBar::PresentationSearchBar( Okular::Document *document, QWidge
lay->setContentsMargins( 0, 0, 0, 0 );
m_handle = new HandleDrag( this );
m_handle->installEventFilter( this );
lay->addWidget( m_handle );
QToolButton * closeBtn = new QToolButton( this );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment