| 1 |
// -*- C++ -*- |
| 2 |
// $Id: TestLabelWriterFilter.cpp 4759 2008-06-19 19:02:27Z vbuzuev $ |
| 3 |
|
| 4 |
// DYMO LabelWriter Drivers |
| 5 |
// Copyright (C) 2008 Sanford L.P. |
| 6 |
|
| 7 |
// This program is free software; you can redistribute it and/or |
| 8 |
// modify it under the terms of the GNU General Public License |
| 9 |
// as published by the Free Software Foundation; either version 2 |
| 10 |
// of the License, or (at your option) any later version. |
| 11 |
|
| 12 |
// This program is distributed in the hope that it will be useful, |
| 13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
// GNU General Public License for more details. |
| 16 |
|
| 17 |
// You should have received a copy of the GNU General Public License |
| 18 |
// along with this program; if not, write to the Free Software |
| 19 |
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 |
|
| 21 |
#include "TestCommon.h" |
| 22 |
#include "TestLabelWriterFilter.h" |
| 23 |
#include "MOCK_PrintEnvironment.h" |
| 24 |
#include "../LabelWriterDriver.h" |
| 25 |
#include "../CupsFilterLabelWriter.h" |
| 26 |
|
| 27 |
#include <ostream> |
| 28 |
|
| 29 |
using namespace std; |
| 30 |
using namespace DymoPrinterDriver; |
| 31 |
|
| 32 |
// Registers the fixture into the 'registry' |
| 33 |
CPPUNIT_TEST_SUITE_REGISTRATION(LabelWriterFilterTest); |
| 34 |
|
| 35 |
void |
| 36 |
LabelWriterFilterTest::setUp() |
| 37 |
{ |
| 38 |
ppd_ = ppdOpenFile("../../../ppd/lwtt.ppd"); |
| 39 |
CPPUNIT_ASSERT(ppd_ != NULL); |
| 40 |
|
| 41 |
ppdMarkDefaults(ppd_); |
| 42 |
|
| 43 |
Driver_ = new CLabelWriterDriverTwinTurbo(Env_); |
| 44 |
LM_ = new CDummyLanguageMonitor(Env_); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
void |
| 49 |
LabelWriterFilterTest::tearDown() |
| 50 |
{ |
| 51 |
ppdClose(ppd_); |
| 52 |
delete Driver_; |
| 53 |
delete LM_; |
| 54 |
} |
| 55 |
|
| 56 |
void |
| 57 |
LabelWriterFilterTest::testDensity() |
| 58 |
{ |
| 59 |
ppdMarkOption(ppd_, "DymoPrintDensity", "Light"); |
| 60 |
CDriverInitializerLabelWriter::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 61 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriver::pdLow, Driver_->GetDensity()); |
| 62 |
|
| 63 |
ppdMarkOption(ppd_, "DymoPrintDensity", "Medium"); |
| 64 |
CDriverInitializerLabelWriter::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 65 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriver::pdMedium, Driver_->GetDensity()); |
| 66 |
|
| 67 |
ppdMarkOption(ppd_, "DymoPrintDensity", "Normal"); |
| 68 |
CDriverInitializerLabelWriter::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 69 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriver::pdNormal, Driver_->GetDensity()); |
| 70 |
|
| 71 |
ppdMarkOption(ppd_, "DymoPrintDensity", "Dark"); |
| 72 |
CDriverInitializerLabelWriter::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 73 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriver::pdHigh, Driver_->GetDensity()); |
| 74 |
} |
| 75 |
|
| 76 |
void |
| 77 |
LabelWriterFilterTest::testQuality() |
| 78 |
{ |
| 79 |
ppdMarkOption(ppd_, "DymoPrintQuality", "Text"); |
| 80 |
CDriverInitializerLabelWriter::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 81 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriver::pqText, Driver_->GetQuality()); |
| 82 |
|
| 83 |
ppdMarkOption(ppd_, "DymoPrintQuality", "Graphics"); |
| 84 |
CDriverInitializerLabelWriter::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 85 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriver::pqBarcodeAndGraphics, Driver_->GetQuality()); |
| 86 |
} |
| 87 |
|
| 88 |
void |
| 89 |
LabelWriterFilterTest::testRoll() |
| 90 |
{ |
| 91 |
ppdMarkOption(ppd_, "InputSlot", "Auto"); |
| 92 |
CDriverInitializerLabelWriterTwinTurbo::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 93 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriverTwinTurbo::rtAuto, Driver_->GetRoll()); |
| 94 |
|
| 95 |
ppdMarkOption(ppd_, "InputSlot", "Left"); |
| 96 |
CDriverInitializerLabelWriterTwinTurbo::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 97 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriverTwinTurbo::rtLeft, Driver_->GetRoll()); |
| 98 |
|
| 99 |
ppdMarkOption(ppd_, "InputSlot", "Right"); |
| 100 |
CDriverInitializerLabelWriterTwinTurbo::ProcessPPDOptions(*Driver_, *LM_, ppd_); |
| 101 |
CPPUNIT_ASSERT_EQUAL(CLabelWriterDriverTwinTurbo::rtRight, Driver_->GetRoll()); |
| 102 |
} |
| 103 |
|
| 104 |
/* |
| 105 |
* End of "$Id: TestLabelWriterFilter.cpp 4759 2008-06-19 19:02:27Z vbuzuev $". |
| 106 |
*/ |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|