void ribi::braw::qtbrainweaverprintconceptmapdialog_test::default_construct()
{
  const auto files = FileFactory().GetTests();
  for (const auto file: files) {
    QtPrintConceptMapDialog d(file);
    d.show();
    QTest::qWait(1000);
    for (const ribi::cmap::QtNode * const qtnode:
      ribi::cmap::GetQtNodes(d.m_widget->GetScene())
    )
    {
      QVERIFY(qtnode != nullptr);
      QVERIFY(qtnode->isVisible());
      #ifdef REALLY_CARE_20161008
      //All QtNodes' their rectangles should be within all_items_rect
      const QRectF all_items_rect {
        //d.m_widget->scene()->itemsBoundingRect() //Does not work
        //d.m_widget->scene()->sceneRect() //Does not work
        d.m_widget->sceneRect()
      };
      QVERIFY(all_items_rect.contains(qtnode->boundingRect()));
      #endif
    }
  }
}
void ribi::braw::qtbrainweaverdisplay_test::display_rated_concepts()
{
  File f = FileFactory().GetTests().back();
  const QtDisplay d;
  std::unique_ptr<QTableWidget> widget(new QTableWidget);
  widget->setRowCount(4);
  widget->setColumnCount(3);
  widget->show();
  d.DisplayRatedConcepts(f, widget.get());
  QVERIFY("Should get here");
}
void ribi::braw::qtbrainweaverdisplay_test::display_misc_values()
{
  const QtDisplay d;
  std::unique_ptr<QTableWidget> widget(new QTableWidget);
  widget->setRowCount(4);
  widget->setColumnCount(3);
  widget->show();
  File f = FileFactory().Get5();
  d.DisplayMiscValues(f, widget.get());
  QVERIFY("Should get here");
}
void ribi::braw::qtbrainweaverdisplay_test::display_examples()
{
  File f = FileFactory().Get5();
  const QtDisplay d;
  std::unique_ptr<QTableWidget> widget(new QTableWidget);
  widget->setColumnCount(2);
  widget->setRowCount(7);
  widget->show();
  d.DisplayExamples(f, widget.get());
  QVERIFY("Should get here");
}
Exemplo n.º 5
0
   // PfmFormatterDispatch::Open
void CCALL Volume::Open( PfmMarshallerOpenOp* op, void* formatterUse)
{
   const PfmNamePart* nameParts = op->NameParts();
   size_t namePartCount = op->NamePartCount();
   int8_t createFileType = op->CreateFileType();
   int8_t createFileFlags = op->CreateFileFlags();
   int64_t writeTime = op->WriteTime();
   int64_t newCreateOpenId = op->NewCreateOpenId();
   int64_t newExistingOpenId = op->NewExistingOpenId();
   int perr;
   bool existed = false;
   PfmOpenAttribs openAttribs = zeroOpenAttribs;
   int64_t parentFileId = 0;
   const wchar_t* endName = 0;
   File* file;
   File* parent;
   File** sibPrev;

   perr = FindFile( nameParts, namePartCount, &file, &parent, &sibPrev);
   if (!perr)
   {
      if (file)
      {
         existed = true;
         file->Open( newExistingOpenId, &openAttribs, &parentFileId, &endName);
      }
      else
      {
            // Name must have 1 or more parts or would have found root.
         ASSERT( namePartCount && parent && sibPrev);
         if (createFileType == pfmFileTypeNone)
         {
            perr = pfmErrorNotFound;
         }
         else
         {
            perr = FileFactory( parent, sibPrev, nameParts[ namePartCount-1].name, createFileType, createFileFlags, writeTime, &file);
            if (!perr)
            {
               file->Open( newCreateOpenId, &openAttribs, &parentFileId, &endName);
            }
         }
      }
   }

   op->Complete( perr, existed, &openAttribs, parentFileId, endName, 0, 0, 0, 0);
}
void ribi::braw::qtbrainweaverprintconceptmapdialog_test::print_should_produce_file()
{
  const auto file = FileFactory().Get3();
  QtPrintConceptMapDialog d(file);
  d.show();
  const std::string filename{
    "qtbrainweaverprintconceptmapdialog_test.pdf"
  };
  if (ribi::is_regular_file(filename)) { ribi::delete_file(filename); }
  QVERIFY(!ribi::is_regular_file(filename));
  d.Print(filename);
  QVERIFY(ribi::is_regular_file(filename));

  //Cleanup
  if (ribi::is_regular_file(filename)) { ribi::delete_file(filename); }
  assert(!ribi::is_regular_file(filename));
}
Exemplo n.º 7
0
   // PfmFormatterDispatch::Replace
void CCALL Volume::Replace( PfmMarshallerReplaceOp* op, void* formatterUse)
{
   int64_t targetOpenId = op->TargetOpenId();
   int64_t targetParentFileId = op->TargetParentFileId();
   const PfmNamePart* targetEndName = op->TargetEndName();
   uint8_t createFileFlags = op->CreateFileFlags();
   int64_t writeTime = op->WriteTime();
   int64_t newCreateOpenId = op->NewCreateOpenId();
   int perr;
   PfmOpenAttribs openAttribs = zeroOpenAttribs;
   File* target;
   File* file;

   perr = FindOpenFile( targetOpenId, &target);
   if (!perr)
   {
      if (target == &root)
      {
            // Can't replace root.
         perr = pfmErrorAccessDenied;
      }
      else if (!target->name)
      {
         perr = pfmErrorDeleted;
      }
      else
      {
         perr = FileFactory( target->parent, target->sibPrev, target->name, target->fileType, createFileFlags, writeTime, &file);
         if (!perr)
         {
            target->Delete( writeTime, false/*leaveChildren*/);
            file->Open( newCreateOpenId, &openAttribs, 0, 0);
         }
      }
   }

   op->Complete( perr, &openAttribs, 0);
}